1

Is there an elegant way to access the names of the months and weekdays in moment.js without changing the global moment.js object.

What I have currently in place is

var localeData = moment.localeData(superDynamicallyLoadLocale());
var months = localeData._months;

This seems to be rather fragile, as the name for the actual months array can change at the maintainers discretion.

I've had a look at this answer which is acceptable, but is there a way that does not involve iteration over the months/weekdays? After all, the data is there in the correct format already.

Community
  • 1
  • 1
wonderb0lt
  • 2,035
  • 1
  • 23
  • 37
  • I have the same question: moment.weekdays() returns a list of weekdays, but moment.localeData(locale).weekdays() requires you to pass a moment object and will return the weekday of that object. Can I just get a list of the weekdays based on the specified locale? – Tyler Marien Jun 11 '15 at 18:25

0 Answers0