Day of Week (Locale Aware)2.1.0+

  1. moment().weekday(Number);
  2. 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.

  1. // when Monday is the first day of the week
  2. moment().weekday(-7); // last Monday
  3. moment().weekday(7); // next Monday
  4. // when Sunday is the first day of the week
  5. moment().weekday(-7); // last Sunday
  6. moment().weekday(7); // next Sunday