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.formatToParts() does not include part of type fractionalSecond #48882

Open
jordanmbell opened this issue Apr 29, 2022 · 1 comment · May be fixed by #48945
Open

Intl.DateTimeFormat.formatToParts() does not include part of type fractionalSecond #48882

jordanmbell opened this issue Apr 29, 2022 · 1 comment · May be fixed by #48945
Assignees
Labels
Bug Domain: lib.d.ts Fix Available Good First Issue Help Wanted

Comments

@jordanmbell
Copy link

@jordanmbell jordanmbell commented Apr 29, 2022

lib Update Request

Configuration Check

My compilation target is esnext and my lib is the default.

Missing / Incorrect Definition

Intl.DateTimeFormat.prototype.formatToParts

Sample Code

new Intl.DateTimeFormat().formatToParts().find((val) => val.type === 'fractionalSecond')

Documentation Link

Added in ECMAScript 2021: https://402.ecma-international.org/#sec-formatdatetimepattern

Also mentioned in MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts#description

jordanmbell added a commit to jordanmbell/TypeScript that referenced this issue Apr 29, 2022
This change adds the `fractionalSecond` part type as a valid part
to be returned from Intl.DateTimeFormat().formatToParts().

Fixes microsoft#48882
@andrewbranch andrewbranch added Domain: lib.d.ts Bug Help Wanted Good First Issue labels May 2, 2022
@andrewbranch andrewbranch added this to the TypeScript 4.8.0 milestone May 2, 2022
@typescript-bot typescript-bot added the Fix Available label May 3, 2022
@lzcampos
Copy link

@lzcampos lzcampos commented May 24, 2022

Hi!

I've seen that this sample sample code does not result on access to 'hours' or even a 'minutes' object. Is that the bug to fix or it should just include 'fractionalSecond' property too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Domain: lib.d.ts Fix Available Good First Issue Help Wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants