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

Non-ISO/gregory calendar support in older browsers #37

Open
arshaw opened this issue Apr 6, 2024 · 0 comments
Open

Non-ISO/gregory calendar support in older browsers #37

arshaw opened this issue Apr 6, 2024 · 0 comments

Comments

@arshaw
Copy link
Member

arshaw commented Apr 6, 2024

Issue #34 made explicit that non-ISO/gregory calendar support (like chinese, persian, hebrew) have higher minimum browser requirements than other features:

Chrome 80
(Feb 2020)
Firefox 76
(May 2020)
Safari 14.1
(Apr 2021)
Safari iOS 14.5
(Apr 2021)
Edge 80
(Feb 2020)
Node.js 14
(Apr 2020)

This is because temporal-polyfill relies on the Intl.DateTimeFormat constructor supporting the calendar option.

To be able to support older browsers, the calendar option would need be polyfilled. Unfortunately Format.JS explicitly does not support any calendar other than ISO/gregory.

Aside from polyfilling calendar support into Intl.DateTimeFormat, one might be able to hook-in the required calendar computations into temporal-polyfill itself. However, then formatting functions like toLocaleString would not work, nor would passing in Temporal objects to Intl.DatetimeFormat::format(). In my opinion, polyfilling calendar support into Intl.DateTimeFormat is the best way.

This ticket proposes polyfilling calendar support into Intl.DateTimeFormat.

It'd be possible to use @internationalized/date's calendar y/m/w/d computations:
https://github.com/adobe/react-spectrum/tree/main/packages/%40internationalized/date/src/calendars

It'd be theoretically possible to scrape-out information about formatting from a modern browser that supports calendar. It would be challenging because nearly every permutation of the Intl.DateTimeFormat must be considered.

@arshaw arshaw mentioned this issue Apr 6, 2024
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