Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibJS: Can not parse dates without leading zero #25022

Open
dotnetCarpenter opened this issue Sep 14, 2024 · 0 comments
Open

LibJS: Can not parse dates without leading zero #25022

dotnetCarpenter opened this issue Sep 14, 2024 · 0 comments

Comments

@dotnetCarpenter
Copy link

Build fe8a64d can not parse dates, where the month is without a leading zero - unless there is a time part.

Using /Build/lagom/bin/js :

> new Date ("2024-7-24")
[Date] Invalid Date
> new Date ("2024-7-24 10:00")
[Date] Wed Jul 24 2024 10:00:00 GMT+0200 (Central European Summer Time)
> new Date ("2024-07-24")
[Date] Wed Jul 24 2024 02:00:00 GMT+0200 (Central European Summer Time)

Using V8:

> new Date ("2024-7-24")
2024-07-23T22:00:00.000Z // <- probably not what you want
> new Date ("2024-7-24 10:00")
2024-07-24T08:00:00.000Z
> new Date ("2024-07-24")
2024-07-24T00:00:00.000Z

Using SpiderMonkey:

> new Date ("2024-7-24")
Date Wed Jul 24 2024 02:00:00 GMT+0200 (Central European Summer Time)
> new Date ("2024-7-24 10:00")
Date Wed Jul 24 2024 10:00:00 GMT+0200 (Central European Summer Time)
> new Date ("2024-07-24")
Date Wed Jul 24 2024 02:00:00 GMT+0200 (Central European Summer Time)

Since YYYY-M-DD is not a valid ISO 8601 date, the behaviour is probably undefined in any spec but I've seen it in the wild.

With Ladybird's sister project, also named Ladybird, I saw yesterday on youtube.com, the following error log:

10309.331 WebContent(23165): Unable to parse date string: "2024-7-24"

Log from Ladybird yesterday (2024-09-13)

Today I checked with Serenity's Ladybird and did not see the same error. But I assume the date is dynamic on youtube.com.

Related: #19030 LadybirdBrowser/ladybird#1395

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant