First Day of Week and First Week of Year1.0.0+

  1. // From 2.12.0 onward
  2. moment.updateLocale('en', {
  3. week : {
  4. dow : Int,
  5. doy : Int
  6. }
  7. });
  8. // From 2.8.1 to 2.11.2
  9. moment.locale('en', {
  10. week : {
  11. dow : Int,
  12. doy : Int
  13. }
  14. });
  15. // Deprecated in 2.8.1
  16. moment.lang('en', {
  17. week : {
  18. dow : Int,
  19. doy : Int
  20. }
  21. });

Locale#week.dow should be an integer representing the first day of the week, 0 is Sunday, 1 is Monday, …, 6 is Saturday.

Locale#week.doy should be an integer. doy is used together with dow to determine the first week of the year. doy is calculated as 7 + dow - janX, where janX is the first day of January that must belong to the first week of the year.

  1. // ISO-8601, Europe
  2. moment.updateLocale("en", { week: {
  3. dow: 1, // First day of week is Monday
  4. doy: 4 // First week of year must contain 4 January (7 + 1 - 4)
  5. }});
  6. // US, Canada
  7. moment.updateLocale("en", { week: {
  8. dow: 0, // First day of week is Sunday
  9. doy: 6 // First week of year must contain 1 January (7 + 0 - 1)
  10. }});
  11. // Many Arab countries
  12. moment.updateLocale("en", { week: {
  13. dow: 6, // First day of week is Saturday
  14. doy: 12 // First week of year must contain 1 January (7 + 6 - 1)
  15. }});
  16. // Also common
  17. moment.updateLocale("en", { week: {
  18. dow: 1, // First day of week is Monday
  19. doy: 7 // First week of year must contain 1 January (7 + 1 - 1)
  20. }});