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

Closed
mstssk opened this issue May 2, 2022 · 2 comments · Fixed by #49014 or #49042
Closed
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Good First Issue Well scoped, documented and has the green light Help Wanted You can do this lib update PR modifies files in the `lib` folder

Comments

@mstssk
Copy link
Contributor

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

@andrewbranch andrewbranch added Bug A bug in TypeScript Help Wanted You can do this Good First Issue Well scoped, documented and has the green light lib update PR modifies files in the `lib` folder labels May 3, 2022
@andrewbranch andrewbranch added this to the TypeScript 4.8.0 milestone May 3, 2022
@Uda-Titor
Copy link
Contributor

I want to contribute this issuse

@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label May 8, 2022
@mstssk
Copy link
Contributor Author

mstssk commented May 10, 2022

@sandersn This issue seems to does not resolved.

#49014 resolved only ResolvedDateTimeFormatOptions.

fractionalSecondDigits?: 1 | 2 | 3;

However DateTimeFormatOptions is not resolved.

fractionalSecondDigits?: 0 | 1 | 2 | 3 | undefined;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Good First Issue Well scoped, documented and has the green light Help Wanted You can do this lib update PR modifies files in the `lib` folder
Projects
None yet
5 participants