From the moment docs setting format as l
returns in format "M/D/YYYY".
Is there a way to get the date in just D/M
or M/D
format depending on locale? Here is the code i have right now.
var locale = window.navigator.userLanguage || window.navigator.language;
moment.locale(locale);
var momentTime = moment(d);
console.log(momentTime.format('l'));
For instance if the locale is French
then the date should be returned in D/M
format and if the locale is english-us
then the date should be returned in M/D
format automatically.