62
rated 0 times
[
63]
[
1]
/ answers: 1 / hits: 18996
/ 9 Years ago, thu, december 10, 2015, 12:00:00
My application sends an HTML file with javascript like this:
$(function () {
moment.locale('fr');
$('#datetimepicker9').datetimepicker({
viewMode: 'years',
locale: 'fr',
format: '' /* <========= problem! */
});
});
With moment, when I set to a locale, is there a way to get the short date format of the configuration like 'j F Y'
for fr
?
I found it but it's hack-ish:
moment()['_locale']['_longDateFormat']['L']
So my code now:
$(function () {
moment.locale('fr');
$('#datetimepicker9').datetimepicker({
viewMode: 'years',
locale: 'fr',
format: moment()['_locale']['_longDateFormat']['L']
});
});
I dont like that, is there a clean way to get the format?
More From » momentjs