Description
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
- From a post edit screen, open the browser console.
- Type
moment().format('LLL');
- See incorrect result.
- 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