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

Polyfill DateTimeFormat en-GB seems to be incorrect #1951

Closed
millitza opened this issue Aug 12, 2020 · 3 comments
Closed

Polyfill DateTimeFormat en-GB seems to be incorrect #1951

millitza opened this issue Aug 12, 2020 · 3 comments
Labels

Comments

@millitza
Copy link

Which package?
intl-datetimeformat

Describe the bug
When using the polyfill for the date time format and en-GB locale data, the date formatting seems to be incorrect. Rather than format "d/MMM/y" it results in a format "d MMM y". This is not consistent with the non polyfilled behavior.

To Reproduce
Steps to reproduce the behavior:

Minimal example:

require('@formatjs/intl-datetimeformat/polyfill');
require('@formatjs/intl-datetimeformat/locale-data/en-GB');

const formatter = new Intl.DateTimeFormat('en-GB');
const result = formatter.format(new Date());

console.log(result); // prints: "12 8 2020", expected value: "12/8/2020" or "12/08/2020"

Expected behavior
I expect the date to be of format "d/MMM/y": forward slash as a separator sign, rather than a space.
e.g in Chrome (no polyfill):
Screenshot 2020-08-12 at 10 05 18

Additional context
Failing test: https://travis-ci.org/github/Sensorfactdev/i18n/builds/716981838

The issue is resolved when manually updating the en-GB locale data file: update the first occurence of "d MMM y" to "d/MMM/y".

@millitza millitza added the bug label Aug 12, 2020
@longlho
Copy link
Member

longlho commented Aug 12, 2020

Thanks for reporting! We'll take a look asap.

@longlho
Copy link
Member

longlho commented Aug 13, 2020

@formatjs/intl-datetimeformat@2.4.0 should have the fix for this

@millitza
Copy link
Author

Thanks for the quick response and fix. I can confirm that this is fixed now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants