function updateMomentStartOfWeek() {
  const startOfWeekDayName = MetabaseSettings.get("start-of-week");
  if (!startOfWeekDayName) {
    return;
  }

  const START_OF_WEEK_DAYS = [
    "sunday",
    "monday",
    "tuesday",
    "wednesday",
    "thursday",
    "friday",
    "saturday",
  ];

  const startOfWeekDayNumber = START_OF_WEEK_DAYS.indexOf(startOfWeekDayName);
  if (startOfWeekDayNumber === -1) {
    return;
  }
  console.log(
    "Setting moment.js start of week for Locale",
    moment.locale(),
    "to",
    startOfWeekDayName,
  );

  moment.updateLocale(moment.locale(), {
    week: {
      // Moment.js dow range Sunday (0) - Saturday (6)
      dow: startOfWeekDayNumber,
    },
  });
}
// Tell Moment.js to use the value of the start-of-week Setting for its current locale
Tell Moment.js to use the value of the start-of-week Setting for its current locale
Tell Moment . js to use the value of the start - of - week Setting for its current locale
function updateMomentStartOfWeek() {
  const startOfWeekDayName = MetabaseSettings.get("start-of-week");
  if (!startOfWeekDayName) {
    return;
  }
  const START_OF_WEEK_DAYS = [
    "sunday",
    "monday",
    "tuesday",
    "wednesday",
    "thursday",
    "friday",
    "saturday",
  ];
  const startOfWeekDayNumber = START_OF_WEEK_DAYS.indexOf(startOfWeekDayName);
  if (startOfWeekDayNumber === -1) {
    return;
  }
  console.log(
    "Setting moment.js start of week for Locale",
    moment.locale(),
    "to",
    startOfWeekDayName,
  );
  moment.updateLocale(moment.locale(), {
    week: {
      dow: startOfWeekDayNumber,
    },
  });
}
function updateMomentStartOfWeek ( ) { const startOfWeekDayName = MetabaseSettings . get ( "start-of-week" ) ; if ( ! startOfWeekDayName ) { return ; } const START_OF_WEEK_DAYS = [ "sunday" , "monday" , "tuesday" , "wednesday" , "thursday" , "friday" , "saturday" , ] ; const startOfWeekDayNumber = START_OF_WEEK_DAYS . indexOf ( startOfWeekDayName ) ; if ( startOfWeekDayNumber === - 1 ) { return ; } console . log ( "Setting moment.js start of week for Locale" , moment . locale ( ) , "to" , startOfWeekDayName , ) ; moment . updateLocale ( moment . locale ( ) , { week : { dow : startOfWeekDayNumber , } , } ) ; }
Tell Moment.js to use the value of the start-of-week Setting for its current locale
Tell Moment . js to use the value of the start - of - week Setting for its current locale
// Moment.js dow range Sunday (0) - Saturday (6)