Well, I want to check if a day of date is Monday like:
$scope.myDate = new Date();
moment($scope.myDate, 'DD-MM-YYYY').dayIs('monday')
In Chile - my country - the first day of week is Monday, so, really I want check if the input date is begin of week.
I try using moment($scope.myDate, 'DD-MM-YYYY').startOf('isoweek')
but, this don't work for me.
According to the documentation - Moment.js has a locale setting which should solve this for you;
Day of Week (Locale Aware) 2.1.0+
moment().weekday(Number);
moment().weekday(); // Number
Gets or sets the day of the week according to the locale.
If the locale assigns Monday as the first day of the week, moment().weekday(0) will be Monday. If Sunday is the first day of the week, moment().weekday(0) will be Sunday.
Here you can see how to set the locale;
moment.locale('en'); // set to english
来源:https://stackoverflow.com/questions/41638428/check-if-the-input-day-is-monday-with-moment-js