Sara
Sara

Reputation: 2769

Using momentjs to format a date in a specific locale

I have a global locale variable based on a user's preference. When I pass that variable to moment along with a timestamp, it still displays the date in English. I'd like it to display the date in the common format for that locale. For example:

moment.locale('fr');
console.log(moment(867283200, "X").format('LL')); //still outputs June 25, 1997 when it should be using French months

Any suggestions?

Upvotes: 1

Views: 645

Answers (1)

Sara
Sara

Reputation: 2769

Figured it out. I just needed to load the locales in the browser using the locales.min.js available here: https://github.com/moment/moment/tree/develop/min

Upvotes: 2

Related Questions