Skip to content
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

Replace all date formatting to use native APIs #2056

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

neatchee
Copy link

@neatchee neatchee commented Dec 30, 2022

  • use date.toLocaleString instead of react-intl

Mastodon shows 24:00 instead of 00:00 for midnight and later times, due to an issue with older versions of react-intl. Upgrading react-intl from v2=>v3 includes breaking changes. Instead, stop using react-intl and instead use native browser APIs, since they have stabilized.

To be extremely precise, the hour12 option is supposed to swap hourCycle between either h11 and h23, or h12 and h24, as is described in ECMAScript. However, Chrome is the only large browser who actually follows this spec. Most other browsers implement hour12 as setting hourCycle to h12 when true, and h23 when false, which is probably the more "human" way to think of hour12. There is already an ECMA proposal to fix this (coincidentally, issue 402 in ecma402 😄)

Anyway, it makes more sense to directly set the hourCycle to h23 instead of hour12 to false, since hour12 doesn't do what's expected in Chrome. Or well, because Chrome follows the ECMAScript spec, and the spec doesn't do what a human would expect.

Fixes #2050

Upstream PR: mastodon#22850

* use date.toLocaleString instead of react-intl

Mastodon shows 24:00 instead of 00:00 for midnight and later times, due to an issue with older versions of react-intl. Upgrading react-intl from v2=>v3 includes breaking changes. Instead, stop using react-intl and instead use native browser APIs, since they have stabilized.
@github-actions
Copy link

github-actions bot commented Jan 5, 2023

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions
Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants