I set the locale to 'ro' and now weekdays are in romanian.
But, I also set the
week : {
dow : 1
}
and moment.weekdays() returns days as in 'en' starting with Sunday. Why is this happening?
You have to use moment.weekdays(true);
As the docs states:
As of 2.13.0 you can pass a bool as the first parameter of the weekday functions. If true, the weekdays will be returned in locale specific order. For instance, in the Arabic locale, Saturday is the first day of the week
Here a live example:
moment.locale('ro');
// duminică to sâmbătă
console.log(moment.weekdays());
// locale aware: luni to duminică
console.log(moment.weekdays(true));
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment-with-locales.min.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With