-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
Implement Date parsing according to the spec #3564
Conversation
Test262 conformance changes
Fixed tests (14):
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3564 +/- ##
==========================================
+ Coverage 47.42% 47.44% +0.02%
==========================================
Files 470 470
Lines 45690 45809 +119
==========================================
+ Hits 21667 21734 +67
- Misses 24023 24075 +52 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! I really like some aspects of it!
I was going to have a bit of a nit about MINUS
being used, but it looks like it's not in the ECMAScript spec 😅
.and_then(|c| if c == expect { Some(()) } else { None }) | ||
} | ||
|
||
fn next_digit(&mut self) -> Option<u8> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooooh, I like this. Definitely makes other parts of parsing a lot nicer too!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Looks good to me! :)
This PR implements parsing in
Date()
andDate.parse()
according to the spec.Until now we only parsed the given string in the RFC 3339 format. The spec allows for a more relaxed format, for example partial formats are allowed (e.g.
2024
,2024T00:00
, ...). While the spec allows for implementation specifc parsing it also specifies that the output ofDate.toString
,Date.toUTCString
andDate.toISOString
must be parsable into an equalDate
object. These formats are now also parsed (theDate.toISOString
format is the same that the spec defines itself).