Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Update and Map Deprecated Timezone #2842

Merged
merged 3 commits into from
Jan 10, 2025
Merged

Update and Map Deprecated Timezone #2842

merged 3 commits into from
Jan 10, 2025

Conversation

ginabak
Copy link
Contributor

@ginabak ginabak commented Jan 8, 2025

Description

(similar to shopify-internal)

📣 ❤️ co-authors with @trishrempel @christina-tran @jesstelford ❤️

Preps https://github.com/Shopify/web/issues/146409
Preps https://github.com/Shopify/web/issues/150625

There are some bugsnag errors for the error, errorMessage:"Invalid time zone specified: Europe/Kyiv", although browser versions are part of this 🙄 , we decided that the best fix would be to allow for deprecated timezones as some of the browser versions are recent like 131 for chrome, seen here on BugSnag

This PR:

  • allows for Europe/Kyiv for older browsers 😬 (basically it's now backwards compatible), a thought though ... I'm curious if the deprecated Europe/Kiev is no longer allowed (which probably won't happen for a while ... ) we'll have to delete this line 😄
  • maps the Europe/Kyiv timezone for react-i18n

@shopify-shipitnext
Copy link

🔎 View this PR in Shipit Next.

ℹ️ Expand to learn how to deploy and handle emergencies using Shipit Next

Overview

Shipit Next will merge your code on your behalf because this repository uses Shipit Next and its merge queue.

To ship this PR, you can either:

Comment Commands

  • /shipit: Enqueue this PR into the merge queue where it will eventually be merged and deployed.
  • /cancel: Eject this PR from the merge queue and rebuild PRs that were enqueued after this PR.
  • /shipit --jump-queue: Enqueue this PR at the top of the merge queue where it will be included in the next deploy. Use this for non-emergency situations.
    - Emergency handling procedure for this command can be found here.
  • /shipit --emergency: Merge this PR directly into main and deploy to all environments once all require_for_emergency CI checks pass. Please be aware that changes deployed with this command will not be automatically rolled back.

Commands exclusive to Deploy Before Merge

  • /cancel --emergency: Eject this PR from the merge and rollback any deployments containing this PR.

Documentation

Questions or feedback?

@ginabak
Copy link
Contributor Author

ginabak commented Jan 8, 2025

/snapit

@@ -825,4 +833,8 @@ export class I18n {
private defaultOnError(error: I18nError) {
throw error;
}

private normalizeTimezone(timeZone?: string) {
return timeZone ? mapDeprecatedTimezones(timeZone) : undefined;
Copy link
Contributor Author

@ginabak ginabak Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We initially had a test added to this - but the tests were actually a false positive, testing date for date, the test for the mapping is actually seen in

it('maps deprecated timezones', () => {

@ginabak ginabak marked this pull request as ready for review January 8, 2025 01:28
@ginabak ginabak requested a review from a team as a code owner January 8, 2025 01:28
Co-authored-by: Trish Rempel <[email protected]>
Co-authored-by: Christina Tran <[email protected]>
Co-authored-by: Jess Telford <[email protected]>
@ginabak
Copy link
Contributor Author

ginabak commented Jan 8, 2025

/snapit

Copy link
Contributor

github-actions bot commented Jan 8, 2025

🫰✨ Thanks @ginabak! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

"@shopify/dates": "0.0.0-snapshot-20250108014630",
"@shopify/react-i18n": "0.0.0-snapshot-20250108014630",
"@shopify/react-i18n-universal-provider": "0.0.0-snapshot-20250108014630"

Co-authored-by: Trish Rempel <[email protected]>
Co-authored-by: Christina Tran <[email protected]>
@ginabak
Copy link
Contributor Author

ginabak commented Jan 8, 2025

/snapit

return memoizedGetDateTimeFormat(locales, {
...options,
timeZone: options.timeZone
? mapDeprecatedTimezones(options.timeZone)
Copy link
Contributor Author

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 call formatDate 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 😄

Copy link
Contributor

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.

Copy link
Contributor Author

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 😢

Copy link
Contributor

github-actions bot commented Jan 8, 2025

🫰✨ Thanks @ginabak! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

"@shopify/dates": "0.0.0-snapshot-20250108211454",
"@shopify/react-i18n": "0.0.0-snapshot-20250108211454",
"@shopify/react-i18n-universal-provider": "0.0.0-snapshot-20250108211454"

};

formatDate(date, locale, options);
expect(mapDeprecatedTimezones).toHaveBeenCalledWith('Europe/Kyiv');
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 quilt/packages/dates/src/tests/map-deprecated-timezones.test.ts is testing that it's mapping / converting, feels safe to me - Ideally mocking out a real "bug" would be great here, but since we can't ... this is good enough imo 😄 ❤️

@ginabak
Copy link
Contributor Author

ginabak commented Jan 9, 2025

WAS ABLE TO SUCCESSFULLY tophat in WEB that this actually fixes the deprecated timezone (the screenshot is the purchase order page, where we just manually added the .formatDate on the page, before the fix it was rendering the 500 ReferenceError and now it looks like:

Screenshot 2025-01-09 at 12 56 26 PM

@jesstelford jesstelford merged commit d2c9fae into main Jan 10, 2025
5 checks passed
@jesstelford jesstelford deleted the i18n/date branch January 10, 2025 01:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants