mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Improve date parsing in the js sandbox
If for example dd:mm is failing we just try with d:m which is equivalent to the regex /d{1,2}:m{1,2}/. This way it allows the user to forget the 0 for the first days/months.
This commit is contained in:
parent
e3caa3c6ee
commit
c14c3cfc9f
2 changed files with 21 additions and 2 deletions
|
@ -628,6 +628,10 @@ describe("Scripting", function () {
|
|||
await check("12", "mm", "2000/12/01");
|
||||
await check("2022", "yyyy", "2022/01/01");
|
||||
await check("a1$9bbbb21", "dd/mm/yyyy", "2021/09/01");
|
||||
await check("1/2/2024", "dd/mm/yyyy", "2024/02/01");
|
||||
await check("01/2/2024", "dd/mm/yyyy", "2024/02/01");
|
||||
await check("1/02/2024", "dd/mm/yyyy", "2024/02/01");
|
||||
await check("01/02/2024", "dd/mm/yyyy", "2024/02/01");
|
||||
|
||||
// The following test isn't working as expected because
|
||||
// the quickjs date parser has been replaced by the browser one
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue