Skip to content

Moment localized date formats broken #12626

Open
@mattheu

Description

@mattheu

Describe the bug

If you use moment to display a date, you can pass a localised date format. e.g. LLL moment will format a date like September 4, 1986 8:30 PM. See moment docs: https://momentjs.com/docs/#/displaying/

However in the WP admin this does not work. You get the following result: F j, 2018 g:i pm

This is a regression and worked as expected before Gutenberg version 4.5 - I believe it was broken in this commit: #11938.

Whilst investigating this issue - I see there is some handling of these localised date formats in wp.date package. If the expectation is that I should only use wp.date and never use the globally available copy of moment, then perhaps it should not be available to use? Otherwise I would expect this to work.

To Reproduce

  1. From a post edit screen, open the browser console.
  2. Type moment().format('LLL');
  3. See incorrect result.
  4. If you do the same on momentjs.com you see the expected behaviour.

Expected behavior
The code moment().format('LLL') should work as expected displaying "Month name, day of month, year, time" and also allow this to be localised.

Activity

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

    [Package] Date/packages/date[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions