mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
[JS] - Parse a date in using the given format first and then try the default date parser
- it aims to fix #14672.
This commit is contained in:
parent
079dea2274
commit
f0b549c2a2
3 changed files with 33 additions and 11 deletions
|
@ -53,16 +53,19 @@ class AForm {
|
|||
}
|
||||
|
||||
_parseDate(cFormat, cDate) {
|
||||
const ddate = Date.parse(cDate);
|
||||
if (isNaN(ddate)) {
|
||||
try {
|
||||
return this._util.scand(cFormat, cDate);
|
||||
} catch (error) {
|
||||
return null;
|
||||
let date = null;
|
||||
try {
|
||||
date = this._util.scand(cFormat, cDate);
|
||||
} catch (error) {}
|
||||
if (!date) {
|
||||
date = Date.parse(cDate);
|
||||
if (isNaN(date)) {
|
||||
date = null;
|
||||
} else {
|
||||
date = new Date(date);
|
||||
}
|
||||
} else {
|
||||
return new Date(ddate);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
AFMergeChange(event = globalThis.event) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue