fullcalendar / temporal-polyfill

A lightweight polyfill for Temporal, successor to the JavaScript Date object
MIT License
369 stars 14 forks source link

Calendar-Polyfill #34

Closed NightScript370 closed 7 months ago

NightScript370 commented 8 months ago

On Chrome 72, I am unable to use the Hebrew calendar. I get this error: Uncaught RangeError: Invalid Calendar: hebrew While I do not mind polyfilling it, I am not sure how to do so. Is there a way I could extract the current calendar configurations for use with the custom Temporal.Calendar?

NightScript370 commented 8 months ago

Also, I tried checking support using Intl.supportedValuesOf(). While that isn't available by default, I did polyfill it through this npm library: https://formatjs.io/docs/polyfills/intl-supportedvaluesof

It reported that it did have hebrew, so I tried the site. Here's the conflict. image

arshaw commented 8 months ago

Hi @NightScript370, sorry about the troubles. temporal-polyfill scrapes out the calendar-data from Intl.DateTimeFormat, and it relies on the calendar option having new-ish support. See this support matrix:

https://caniuse.com/mdn-javascript_builtins_intl_datetimeformat_datetimeformat_options_parameter_options_calendar_parameter

Chrome 80 is required unfortunately.

I'll make sure to add this to the docs.

You might be tempted to polyfill Intl.DateTimeFormat, but unfortunately FormatJS doesn't support anything other than iso/gregorian:

https://formatjs.io/docs/polyfills/intl-datetimeformat

arshaw commented 7 months ago

I update the README to explain the higher browser requirements for non-ISO/gregory calendars: https://github.com/fullcalendar/temporal-polyfill?tab=readme-ov-file#browser-support

I've created a separate ticket for discussing how to polyfill this functionality: https://github.com/fullcalendar/temporal-polyfill/issues/37