Answer the question
In order to leave comments, you need to log in
Date format in moment.js depending on locale?
Hello, is it possible in momentjs to change the date format depending on the locale, or how can this be adequately implemented using this library?
For example: for Russian DD.MM for English MM.DD.
Answer the question
In order to leave comments, you need to log in
I can suggest using the format in the object, through a variable (can be global)
var locale = 'en-US'; // Сюда значение получаем любым способом
var momentFormat = {
'en-US' => 'MM/DD/Y',
'ru-RU' => 'DD.MM.YYYY'
}
moment().format(momentFormat[locale]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question