Skip to content

Intl.ResolvedDateTimeFormatOptions is missing properties #45420

Closed

Description

@BPScott

lib Update Request

Configuration Check

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

Missing / Incorrect Definition

Intl.ResolvedDateTimeFormatOptions - the type returned by calling DateTimeFormat's resolvedOptions method - appears to be missing the following properties:

  • dateStyle
  • timeStyle
  • dayPeriod
  • hourCycle
  • fractionalSecondDigits

It looks like these items (along with calendar and numberingSystem) were added to es2020.intl.d.ts's DateTimeFormatOptions however they were never added to ResolvedDateTimeFormatOptions.

It seems that calendar and numberingSystem are both present in es5.d.ts's ResolvedDateTimeFormatOptions. Because of this I am unsure if the absent options should be added to ResolvedDateTimeFormatOptions in es5.d.ts or es2020.d.ts.

https://tc39.es/ecma402/#table-datetimeformat-resolvedoptions-properties is the spec table of possible returned properties

Sample Code

Sample TS playground

console.log(new Intl.DateTimeFormat('en-US', { dateStyle: 'short' }).resolvedOptions().dateStyle)
console.log(new Intl.DateTimeFormat('en-US', { timeStyle: 'long' }).resolvedOptions().timeStyle)

console.log(new Intl.DateTimeFormat('en-US', { dayPeriod: 'narrow' }).resolvedOptions().dayPeriod)
console.log(new Intl.DateTimeFormat('en-US', { timeStyle: 'long', hourCycle:'h24' }).resolvedOptions().hourCycle)

console.log(new Intl.DateTimeFormat('en-US', { fractionalSecondDigits: 1 }).resolvedOptions().fractionalSecondDigits)

The above lines throw type errors saying the various properies on resolvedOptions do not exist

Documentation Link

https://tc39.es/ecma402/#table-datetimeformat-resolvedoptions-properties

Activity

  1. IllusionMH commented on Aug 12, 2021

    @IllusionMH
    Contributor

    Duplicate of #42577 which itself is duplicate of other issues.
    Not a duplicate of linked issue

  2. BPScott commented on Aug 12, 2021

    @BPScott
    Author

    This issue looks to be more thorough than #42577 - which does not mention the dayPeriod or fractionalSecondDigits.

    #42577 has been marked as a duplicate of #35865 / #34399. In both cases that appears to be an incorrect diagnosis, as both of those issues are about improvements to DateTimeFormatOptions, NOT ResolvedDateTimeFormatOptions.

  3. IllusionMH commented on Aug 12, 2021

    @IllusionMH
    Contributor

    Yes, you are correct. Read by diagonal and missed that ResolvedDateTimeFormatOptions were not updated to match other options added to options.

    Also looks like it's tricky question in which file definitions should go as #42945 tries to "move" (in that case just removing) some of this properties of DateTimeFormatOptions to further versions.

  4. added a commit that references this issue on Sep 8, 2021
  5. orta commented on Sep 8, 2021

    @orta
    Contributor

    I'm reasonably sure I've got all these covered and merged into main with in #45647 - should be available in 4.5

  6. BPScott commented on Sep 8, 2021

    @BPScott
    Author

    Heya Orta Therox (@orta),

    I'm not sure if I'm reading that PR correctly but it looks like DateTimeFormatOptions was updated but I can't see any adjustments to ResolvedDateTimeFormatOptions, or any places where the return interface of resolvedOptions() got changed to something else.

  7. BPScott commented on Sep 16, 2021

    @BPScott
    Author

    Ping Orta Therox (@orta), I've just tried on the nightly build playground and it still raises type errors.

    I don't think this issue has been resolved as the types of ResolvedDateTimeFormatOptions don't seem to have been updated

  8. orta commented on Sep 16, 2021

    @orta
    Contributor

    Yep, I agree 👍🏻

  9. BPScott commented on Sep 23, 2021

    @BPScott
    Author
  10. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions