Skip to content

Polyfill DateTimeFormat en-GB seems to be incorrect #1951

@millitza

Description

@millitza

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".

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