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

'useFormatter' hydration error in Azerbaijani #1708

Open
3 tasks done
KamranV21 opened this issue Feb 11, 2025 · 4 comments
Open
3 tasks done

'useFormatter' hydration error in Azerbaijani #1708

KamranV21 opened this issue Feb 11, 2025 · 4 comments
Labels
bug Something isn't working unconfirmed Needs triage. upstream-issue This issue is caused by an upstream dependency (e.g. Next.js)

Comments

@KamranV21
Copy link

KamranV21 commented Feb 11, 2025

Description

When formatting a date using useFormatter with the 'az' locale, I encounter a hydration error. While server-side formatting works as expected, client-side formatting results in an invalid format like 2025 M02 11 20:35:35, which causes a hydration issue.

Verifications

Mandatory reproduction URL

https://codesandbox.io/p/devbox/wild-worker-5t6rvx?file=%2Fsrc%2Fapp%2F%5Blocale%5D%2Fpage.tsx%3A7%2C34

Reproduction description

Steps to reproduce:

  1. Open reproduction
  2. Open console
  3. Switch to Azerbaijani language
  4. Observe invalid date format

Expected behaviour

The date is expected to be formatted correctly on both the client-side and server-side.

@KamranV21 KamranV21 added bug Something isn't working unconfirmed Needs triage. labels Feb 11, 2025
@amannn
Copy link
Owner

amannn commented Feb 12, 2025

Hey, it seems like this is a Chrome-only issue related to the Intl.DateTimeFormat API.

You can verify by running this in Chrome in your console:

// 2025 M02 12 11:13:44
new Intl.DateTimeFormat('az', {dateStyle: "long", timeStyle: "medium",}).format(new Date())

In Safari and Firefox I see the correct behavior. In the latest Node.js version the formatting is also fine.

Maybe you want to file a bug at the Chromium bug tracker?

In regard to your app, maybe you can find a setting that avoids the issue, e.g.:

// "'2025-02-12 11:19:55'"
new Intl.DateTimeFormat('az', {dateStyle: "short", timeStyle: "medium",}).format(new Date())

@amannn amannn added the upstream-issue This issue is caused by an upstream dependency (e.g. Next.js) label Feb 12, 2025
@KamranV21
Copy link
Author

@amannn

Yes, you must be right. This error only appears on Chrome-based browsers. I've created an issue in their bug-tracker. Thank you!

@amannn
Copy link
Owner

amannn commented Feb 12, 2025

Awesome, thanks! Can you leave your created ticket here for reference?

@KamranV21
Copy link
Author

Sure. Here is the link to the related issue on Chromium:
https://issues.chromium.org/issues/396060189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Needs triage. upstream-issue This issue is caused by an upstream dependency (e.g. Next.js)
Projects
None yet
Development

No branches or pull requests

2 participants