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

Incompatibility with @formatjs/datetimeformat polyfill #38

Open
Titozzz opened this issue Jan 13, 2025 · 0 comments
Open

Incompatibility with @formatjs/datetimeformat polyfill #38

Titozzz opened this issue Jan 13, 2025 · 0 comments

Comments

@Titozzz
Copy link

Titozzz commented Jan 13, 2025

When polyfilling Intl.DateTimeFormat with @formatjs/datetimeformat and using tzOffset, 2 issues arise:

https://github.com/formatjs/formatjs/blob/main/packages/ecma402-abstract/IsValidTimeZoneName.ts#L6
https://github.com/date-fns/tz/blob/main/src/tzOffset/index.ts#L20

  1. The timezone format isn't supported by the polyfill (that is supposed to cover 100% of the spec),
    -> So who's correct ? Does the format here or there needs fixing ?

  2. The cache that's added to prevent performance issues is not working when the method throws, so it will try to recreate a new format function on every call, harming performance seriously when using a JS engine that is slow regarding Intl APIs (hermes on react native)

Fixing 1) would mean 2) doesn't affect me anymore but we could still address the issue to not retry and crash everytime.

I'm open to addressing those issues in a PR, but just making just we are aligned first, thanks!

Linked issue in the other repo: formatjs/formatjs#4804

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

No branches or pull requests

1 participant