8000 The "short" timezones are using GMT / UTC instead of locale specific names like CET, CEST. Missing from locale polyfills. · Issue #4509 · formatjs/formatjs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
The "short" timezones are using GMT / UTC instead of locale specific names like CET, CEST. Missing from locale polyfills. #4509
Open
@timkindberg

Description

@timkindberg

Which package?

intl-datetimeformat/locale-data

Describe the bug

Majority of "short" timezones are missing even for the primary locales of a given timezone.

E.g. the "fr" locale file only defines "long" timezones for the "Europe/Paris" timezone. If you render a short timezone you get "UTC" instead of "CET".

Is there any plans to flesh out the short timezones?

To Reproduce

Reproducible Steps/Repo

Steps to reproduce the behavior:

  1. Load polyfills
import '@formatjs/intl-datetimeformat/polyfill-force'
import '@formatjs/intl-datetimeformat/add-all-tz' // Add ALL tz data
import '@formatjs/intl-datetimeformat/locale-data/en'
import '@formatjs/intl-datetimeformat/locale-data/fr'
  1. Render times in the "Europe/Paris" timezone with "short" timeZoneName
const date = new Date()
const options = {
  timeZone: "Europe/Paris",
  hour: 'numeric',
  minute: 'numeric',
  timeZoneName: 'short'
}

console.log('en - ', new Intl.DateTimeFormat('en', options).format(date))
console.log('fr - ', new Intl.DateTimeFormat('fr', options).format(date))
  1. Observe, neither en or fr give "CET". They give GMT and UTC instead.
en - 9:30 PM GMT+1
fr - 21:30 UTC+1
  1. If you open the locale-data/en.js file it's easy to see that the "Europe/Paris" timeZoneName data only has "long" values specified.

Expected behavior

Preferred behavior would be for the timezone to be CET (or CEST)

en - 9:30 PM CET
fr - 21:30 CET

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Mac OS 14.5 (23F79)
  • Browser Arc
  • Version 1.58.0 (53136)-RC
  • Chromium Engine Version 128.0.6613.85

Additional context

date-fns-timezone displayed CET but date-fns-tz was closer to your polyfills. Is there any intention to flesh out these short timezones? or are they left blank on purpose?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0