133
rated 0 times
[
140]
[
7]
/ answers: 1 / hits: 20328
/ 10 Years ago, thu, october 30, 2014, 12:00:00
Using momentJs, is possible to get the first day of the week (Monday(1), Sunday(7)...) based on Locale without creating a new moment?
I know I can access what is the first day of the week for the current locale with:
moment.locale('uk');
moment().startOf('week').isoWeekday(); //Returns 1
moment.locale('en');
moment().startOf('week').isoWeekday(); //Returns 7
But I think it's a bit ugly...
- Creating a momentjs object.
- Going to the first date of the week.
- Resolving the weekDay.
Any better idea?
Thx!
More From » momentjs