This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Update and Map Deprecated Timezone #2842
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@shopify/dates': patch | ||
--- | ||
|
||
Correctly support deprecated timezones in older browsers when calling `formatDate()`. For example, modern browsers support both `Europe/Kyiv` and (the now deprecated) `Europe/Kiev`, but browsers as recent as Chrome 131 on MacOS only support `Europe/Kiev`. Note: This is a purely internal change which should not effect the result of calling `formatDate()`. |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {formatDate} from '../formatDate'; | ||
|
||
jest.mock('../../map-deprecated-timezones', () => ({ | ||
mapDeprecatedTimezones: jest.fn(), | ||
})); | ||
|
||
const mapDeprecatedTimezones: jest.Mock = jest.requireMock( | ||
'../../map-deprecated-timezones', | ||
).mapDeprecatedTimezones; | ||
|
||
describe('formatDate', () => { | ||
it('maps the deprecated timezone', () => { | ||
const date = new Date(); | ||
const locale = 'en-UA'; | ||
const options: Intl.DateTimeFormatOptions = { | ||
timeZone: 'Europe/Kyiv', | ||
}; | ||
|
||
formatDate(date, locale, options); | ||
expect(mapDeprecatedTimezones).toHaveBeenCalledWith('Europe/Kyiv'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. THIS TEST ISN'T GREAT ... but like at least we're testing that the function is actually being called, AND the fact that |
||
}); | ||
}); |
Oops, something went wrong.
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.
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.
HIII @jesstelford ❤️ SOOOOOOOOOO when we implemented the change inside
i18n
and tested out the snapshots ... we weren't able to see the changes actually fix the issue 😬 .... so we're trying it out directly in formatDate as parts of web directly callformatDate
from@shopify/dates
we shipped https://github.com/Shopify/web/pull/152962/files that actually fixes it in web, but if we wanted to do our "due diligence" for other repo's, thought we might as well try this LOL 😄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.
Interesting! During your testing, did you notice any regressions with this change (trying some different mapped and non-mapped timezones)? If not, I agree we should ship this as a bug fix to ensure we've covered all our bases.
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.
HIII JESS!!! do you mean for the
i18n
testing? Or this current one? SADLY Npm hasn't finished propogating lol, so I'm just waiting to test 😢