react-modern-calendar-datepicker icon indicating copy to clipboard operation
react-modern-calendar-datepicker copied to clipboard

First day of week

Open jahicDario opened this issue 4 years ago • 3 comments

Is there a way to change first day of the week to Monday instead of default Sunday?

jahicDario avatar Jul 27 '20 10:07 jahicDario

As far as I know you can only do that by creating a different locale. So please take a look at the docs and feel free to ask something that you can possible be stuck with.

// week days by order
  weekDays: [
    {
      name: 'Monday', // used for accessibility 
      short: 'M', // displayed at the top of days' rows
    },
    {
      name: 'Tuesday',
      short: 'T',
    },
    // ...

Different Locales

BugAgain avatar Jul 31 '20 02:07 BugAgain

As far as I know you can only do that by creating a different locale. So please take a look at the docs and feel free to ask something that you can possible be stuck with.

// week days by order
  weekDays: [
    {
      name: 'Monday', // used for accessibility 
      short: 'M', // displayed at the top of days' rows
    },
    {
      name: 'Tuesday',
      short: 'T',
    },
    // ...

Different Locales

This will show incorrect date for the month? I solved that by setting weekStartingIndex: 6

antonhedstrom avatar Dec 22 '20 15:12 antonhedstrom

You have to use both of the above solutions simultaneously

// week days by order
  weekDays: [
    {
      name: 'Monday', // used for accessibility 
      short: 'M', // displayed at the top of days' rows
    },
    {
      name: 'Tuesday',
      short: 'T',
    },
 {
      name: 'Wednesday',
      short: 'W',
    },
    {
      name: 'Thursday',
      short: 'T',
    },
    {
      name: 'Friday',
      short: 'F',
    },
    {
      name: 'Saturday',
      short: 'S',
      isWeekend: true,
    },
    {
      name: 'Sunday', // used for accessibility 
      short: 'S', // displayed at the top of days' rows
      isWeekend: true, // is it a formal weekend or not?
    },
],

weekStartingIndex: 6,

...

usamamoinakhter avatar Nov 23 '21 00:11 usamamoinakhter