I'm experimenting with dayjs
. Following the example in the documentation, I have set this in my HTML script:
<script src="https://unpkg.com/[email protected]/dayjs.min.js"></script>
<script src="https://unpkg.com/[email protected]/locale/en-gb.js"></script>
In my JS code, I have the lines:
var locale = dayjs.locale('en-gb');
var date = dayjs('1/4/21').format('DD MMM YYYY');
The first line correctly returns locale
as 'en-gb'. However, the second line returns date
as '04 Jan 2021' when it should be '01 Apr 2021', according to the standard British English date order of DMY.
I have checked that the en-gb locale file has the date the right way round.
How do I correct this issue?
Edit
I've since found that moment
has the same problem when using moment-with-locales.js
.