fix: use dynamic UTC expectations in date_proto_set_utc_hours test for timezone portability#4660
Open
Deepak-negi11 wants to merge 2 commits intoboa-dev:mainfrom
Open
Conversation
Test262 conformance changes
|
Member
|
I don't think this is the correct fix; we cannot just leave local time resolution untested. A correct fix would fetch the current datetime externally (maybe with the You pushed an unrelated commit btw 😅 |
Member
|
But I guess we could also apply this and have a separate set of tests for local date + setUTC. |
abd803f to
a5cad20
Compare
Date.UTC() in UTC date tests to avoid timezone sensitivity…r timezone portability
a5cad20 to
24ec184
Compare
Contributor
Author
|
@jedel1043 can you please review it again |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4660 +/- ##
==========================================
+ Coverage 47.24% 56.94% +9.69%
==========================================
Files 476 549 +73
Lines 46892 60129 +13237
==========================================
+ Hits 22154 34238 +12084
- Misses 24738 25891 +1153 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4678
Problem
Some tests in
builtins::date::testswere constructing dates using thelocal-time
Dateconstructor:This interprets arguments as local time, so the resulting UTC components
vary depending on the timezone of the machine running the tests.
For example, in IST (UTC+5:30), local
9:16becomes UTC3:46— the minutesshift by 30. This caused
date_proto_set_utc_hoursto fail because the testexpected UTC minutes to be
16, but they were actually46.Fix
Replaced the local-time constructor with
Date.UTC():Date.UTC()always interprets its arguments as UTC directly, so the UTCcomponents are consistent regardless of the machine's timezone.
Testing
date_proto_set_monthdate_proto_set_utc_hoursTested on IST (UTC+5:30) where the bug was originally discovered.