-
-
Notifications
You must be signed in to change notification settings - Fork 670
fix: Improve date parsing (fractional seconds, UTC offsets) #2803
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
Conversation
Hmmm.. the I'll revert that change and see if the rest passes in CI. |
This reverts commit c456422.
That seems to have been the issue. At least, reverting the fixture for |
@mattjohnsonpint Yes.please ignore std math test in aarch64. It also bother me a lot. I guess there are maybe some bugs in nodes |
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.
LGTM, since the other tests are working as intended.
Co-authored-by: CountBleck <[email protected]>
Applied all feedback, and rebuilt the |
OK, I'm stumped. Why do I get A fixture mismatch error in CI? I used a Windows x64 machine to generate the last ones, and it still fails. Everything passes locally though. 😕 |
Thanks everyone! Please merge when ready. 🙂 |
Looks like everyone's onboard, so I'm merging this. |
The logic used by
Date.fromString
andDate.parse
has a few issues:"2000-01-01T00:00:00.123456789Z"
was being treated as having 123456789 milliseconds, making the result wildly too large. Such values should be truncated to 3 decimal places before being interpreted as milliseconds."2000-01-01T00:00:00.1"
was treated as having 1 millisecond, though it should be one tenth of a second (or 100 milliseconds).+05:30
or-08:00
), which is required by ISO 8601, RFC 3339, and the ECMAScript standard date format.This PR addresses all three issues, and updates the existing
Date#fromString
test.I also made two small unrelated changes:
I32.parseInt
withi32.parse
instd/assembly/date.ts
to resolve deprecation warningsRegenerated the fixture for. (reverted this due to CI test failure. See comments below.)std/math
test to resolve "fixture mismatch" error that was occurring on a clean clone of the repo before I made any changes. (Not sure what update caused that, but compiler tests were failing.)Thanks.