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.
As with moment#day
, if the range is exceeded, it will bubble up to other weeks.
// when Monday is the first day of the week
moment().weekday(-7); // last Monday
moment().weekday(7); // next Monday
// when Sunday is the first day of the week
moment().weekday(-7); // last Sunday
moment().weekday(7); // next Sunday
当前内容版权归 momentjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 momentjs.com .