Reputation: 2811
I am using moment. I format my date with moment().format('LLL')
. Depending on locale it will display the date in the locale format.
However I would need to know what format is used :
In moment js files (inner code), I can find
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
But I don't know if there is a method to access.
Is there a method to say 'hey moment what is the format for this locale and LL' and it would return D MMMM YYYY.
moment().locale('fr').getFormatFor('LL') // output D MMMM YYYY
Thanks,
Stéphane.
Upvotes: 0
Views: 112
Reputation: 2121
The functionality you are looking for is added in version 2.8.0 and higher.
longDateFormat(dateFormat)
https://momentjs.com/docs/#/i18n/locale-data/
Upvotes: 2