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.
Issue #34 made explicit that non-ISO/gregory calendar support (like
chinese,persian,hebrew) have higher minimum browser requirements than other features:(Feb 2020)
(May 2020)
(Apr 2021)
(Apr 2021)
(Feb 2020)
(Apr 2020)
This is because temporal-polyfill relies on the
Intl.DateTimeFormatconstructor supporting thecalendaroption.To be able to support older browsers, the
calendaroption would need be polyfilled. Unfortunately Format.JS explicitly does not support any calendar other than ISO/gregory.Aside from polyfilling
calendarsupport intoIntl.DateTimeFormat, one might be able to hook-in the required calendar computations into temporal-polyfill itself. However, then formatting functions liketoLocaleStringwould not work, nor would passing in Temporal objects toIntl.DatetimeFormat::format(). In my opinion, polyfillingcalendarsupport intoIntl.DateTimeFormatis the best way.This ticket proposes polyfilling
calendarsupport intoIntl.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.