-
Notifications
You must be signed in to change notification settings - Fork 136
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
Intl.DateTimeFormat not polyfilled correctly and always flag crashes Firefox #1012
Comments
@nickrttn Thank you for the issue, I've transferred it to the polyfill-library repository as that is the place where the polyfills are implemented for polyfill.io @longlho, have you seen this Intl error for Firefox 86 before? We currently only target Firefox version below 51: https://github.com/Financial-Times/polyfill-library/blob/493d2d606ef21de644f2b0c62d671d83877175bd/polyfills/Intl/DateTimeFormat/config.toml#L37 I see MDN states some DateTimeFormat features are only available in Firefox 84. MDN hasn't got a version defined for formatRange yet -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#browser_compatibility Does anyone know which version of Firefox added support for the feature? |
@JakeChampion MDN is correct. Firefox doesn't have support for var date1 = new Date(Date.UTC(2007, 0, 10, 10, 0, 0));
var date2 = new Date(Date.UTC(2007, 0, 10, 11, 0, 0));
var fmt1 = new Intl.DateTimeFormat("en", {
year: '2-digit',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric'
});
console.log(!!fmt1.formatRange(date1, date2)) // Uncaught TypeError: fmt1.formatRange is not a function |
Firefox does not support `Intl.DateTimeFormat.prototype.formatRange` Resolves #1012
Thank you for confirming @romainmenke 🙌 I've raised a pull-request to serve this polyfill to all Firefox versions -- #1013 |
I think the same issue also exists for other browsers. ran some tests and seeing the same results for Blink,Webkit,Gecko as stated by MDN |
MDN lists Blink (Chrome and Edge but not Samsung Browser) as supporting formatRange. Did your tests show Chrome and Edge as not supporting Intl.DateTimeFormat.formatRange? |
Chrome supports it, but from |
Firefox does not support `Intl.DateTimeFormat.prototype.formatRange` Resolves #1012
@JakeChampion do you still need me to look at anything? |
I don't think so, @romainmenke helped solve this 😄 |
Thanks for the quick action on this issue folks! The polyfill is now correctly being served. The |
We haven't released this change onto npm or onto polyfill.io yet |
🤦 my bad :) I'll keep an eye on your releases |
Bug report
The
Intl.DateTimeFormat
polyfill doesn't correctly detect support forformatRange
in Firefox (86). That browser doesn't supportformatRange
andformatRangeToParts
but also doesn't receive the polyfill by default.If the
always
flag is passed to force the polyfill Firefox will report an errorUncaught TypeError: Setter must be a function
coming from the polyfill script.Expected behaviour
formatRange
andformatRangeToParts
to be polyfilled when requesting the polyfill for a browser that has parts ofIntl.DateTimeFormat
.always
flag not to cause an errorSteps to reproduce
en
locale (with/without|always
) in FirefoxEnvironment
The text was updated successfully, but these errors were encountered: