-
-
Notifications
You must be signed in to change notification settings - Fork 406
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
[Merged by Bors] - convert inner datetime to local in to_date_string
#1953
[Merged by Bors] - convert inner datetime to local in to_date_string
#1953
Conversation
`Date.prototype.toDateString` should return a value representing the local date. The Rust `Date` inner value represents UTC time, so it should be adjusted to local time before formatting (see `to_string` and `to_time_string`).
Codecov Report
@@ Coverage Diff @@
## main #1953 +/- ##
=======================================
Coverage 45.87% 45.87%
=======================================
Files 206 206
Lines 17102 17102
=======================================
Hits 7846 7846
Misses 9256 9256
Continue to review full report at Codecov.
|
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.
Thank you for the contribution! Indeed this makes much more sense :)
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.
Looks good to me!
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.
bors r+
(there seems to be some issues with CI so this will probably take a bit)
bors r+ |
This Pull Request fixes/closes #1942. `Date.prototype.toDateString` should return a value representing the local date. The Rust `Date` inner value represents UTC time, so it should be adjusted to local time before formatting (see equivalent conversions performed by `to_string` and `to_time_string`). To verify this is working as intended, run the test suite with your OS timezone set to `GMT+0`, then again with `GMT+10`. The test `date_proto_to_date_string` should pass for each. For me (Ubuntu via WSL), this can be done with `sudo dpkg-reconfigure tzdata`. This PR also fixes a couple other test cases that used the wrong month value (as noted at the top of the file, JS months are 0-based while `chrono` months are 1-based).
Pull request successfully merged into main. Build succeeded: |
to_date_string
to_date_string
This Pull Request fixes/closes #1942. `Date.prototype.toDateString` should return a value representing the local date. The Rust `Date` inner value represents UTC time, so it should be adjusted to local time before formatting (see equivalent conversions performed by `to_string` and `to_time_string`). To verify this is working as intended, run the test suite with your OS timezone set to `GMT+0`, then again with `GMT+10`. The test `date_proto_to_date_string` should pass for each. For me (Ubuntu via WSL), this can be done with `sudo dpkg-reconfigure tzdata`. This PR also fixes a couple other test cases that used the wrong month value (as noted at the top of the file, JS months are 0-based while `chrono` months are 1-based).
This Pull Request fixes/closes #1942.
Date.prototype.toDateString
should return a value representing the local date. The RustDate
inner value represents UTC time, so it should be adjusted to local time before formatting (see equivalent conversions performed byto_string
andto_time_string
).To verify this is working as intended, run the test suite with your OS timezone set to
GMT+0
, then again withGMT+10
. The testdate_proto_to_date_string
should pass for each. For me (Ubuntu via WSL), this can be done withsudo dpkg-reconfigure tzdata
.This PR also fixes a couple other test cases that used the wrong month value (as noted at the top of the file, JS months are 0-based while
chrono
months are 1-based).