The Wayback Machine - https://web.archive.org/web/20220502172525/https://github.com/microsoft/TypeScript/issues/48912
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

Type definition for fractionalSecondDigits in Intl.DateTimeFormatOptions has incorrect 0. #48912

Open
mstssk opened this issue May 2, 2022 · 0 comments

Comments

@mstssk
Copy link

@mstssk mstssk commented May 2, 2022

lib Update Request

Configuration Check

My compilation target is es2016 and my lib is es2021.

Missing / Incorrect Definition

fractionalSecondDigits in Intl.DateTimeFormatOptions should not have 0.
However current type definition is fractionalSecondDigits?: 0 | 1 | 2 | 3 | undefined;.
https://github.com/microsoft/TypeScript/blob/v4.6.4/src/lib/es2021.intl.d.ts

Sample Code

Intl.DateTimeFormat("en-US", { fractionalSecondDigits: 0 });
// RangeError: fractionalSecondDigits value is out of range.

This code throws RangeError on Chrome v101, Safari v15.4, Firefox v99 and Node.js v16,v17.

Documentation Link

fractionalSecondDigits values are 1, 2 or 3 in ECMAScript® 2021 Internationalization API Specification.
https://402.ecma-international.org/8.0/#sec-datetimeformat-abstracts

Related conversation at tc39/ecma402#590

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