-
Notifications
You must be signed in to change notification settings - Fork 162
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
fix: Format date localized #3003
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3003 +/- ##
=======================================
Coverage 96.30% 96.30%
=======================================
Files 771 777 +6
Lines 21820 21877 +57
Branches 7450 7480 +30
=======================================
+ Hits 21013 21069 +56
+ Misses 799 755 -44
- Partials 8 53 +45 ☔ View full report in Codecov by Sentry. |
// Store original timezone offset method | ||
const originalTimezoneOffset = Date.prototype.getTimezoneOffset; | ||
|
||
// Mock to simulate Pacific Time (UTC-8/UTC-7) |
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.
as an alternative, it could be achieved via using https://www.npmjs.com/package/timezone-mock lib
@@ -0,0 +1,36 @@ | |||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
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.
I ran this test locally without the changes in format-date-localized
and it also passed.
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.
oh right, because I reproduced this problem locally after changing my system timezone to pacific
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.
I rewrote this as an integration test because the only way to test it in a unit test environment would be to set up a separate environment with a global timezone. Moreover, the integration test I added now fully covers the original bug scenario.
Description
This PR addresses the problem described in the ticket AWSUI-59971 when the date that includes a negative timezone in relation to UTC is parsed incorrectly.
Related links, issue #, if available: n/a
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.