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

Intl.DateTimeFormat.prototype.formatRangeToParts throws TypeError in Firefox 13 - 26 #3158

Open
romainmenke opened this issue Sep 11, 2021 · 4 comments

Comments

@romainmenke
Copy link
Contributor

romainmenke commented Sep 11, 2021

Which package?

Intl.DateTimeFormat (but the actual issue might be in a dependency)

Describe the bug

In older Firefox versions the following TypeError occurs : TypeError: CLDR_NUMBER_PATTERN.exec(...) is null

To Reproduce

var parts = (new Intl.DateTimeFormat('en', {
		hourCycle: 'h11',
		hour: 'numeric',
		timeZone: 'UTC'
	})).formatRangeToParts(43201000 * 4, 43201000 * 5);
console.log(parts);
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>

	<script src="https://polyfill.io/v3/polyfill.js?version=3.101.0&features=Intl.DateTimeFormat,Intl.PluralRules.~locale.en,Intl.NumberFormat.~locale.en,Intl.DateTimeFormat.~locale.en,Intl.getCanonicalLocales,Intl.Locale,Intl.PluralRules,Intl.NumberFormat"></script>
</head>
<body>
	<script>
		var parts = (new Intl.DateTimeFormat('en', {
				hourCycle: 'h11',
				hour: 'numeric',
				timeZone: 'UTC'
			})).formatRangeToParts(43201000 * 4, 43201000 * 5);
		console.log(parts);
	</script>
</body>
</html>

Reproducible Steps/Repo

Run the provided html in Firefox 26.

Expected behavior

Expected not to see a TypeError :)

Screenshots

Screenshot 2021-09-11 at 11 19 14

Desktop (please complete the following information):

  • any OS
  • Firefox
  • 13 - 26

Works in older and more recent versions.
Only fails in this range. (see : https://mrhenry.github.io/web-tests/#1bc7e152-dce1-46cb-a6df-08e5f181d84d)

@longlho
Copy link
Member

longlho commented Sep 13, 2021

Thanks for reporting! We'll take a look asap.

@romainmenke
Copy link
Contributor Author

Chrome versions older than 25 also seem to have an issue but I haven't looked into that yet.
Might be the same thing.

@longlho
Copy link
Member

longlho commented Sep 20, 2021

sry I haven't had time to track this down but this is likely because we can't resolve the pattern for this range (which seems to only request hour). Will try to find some time to look.

@github-actions
Copy link

github-actions bot commented Oct 6, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Oct 6, 2021
@longlho longlho added pinned and removed Stale labels Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants