React-calendar: Only show weekdays, hide weekends (5 days calendar)?

Created on 18 Sep 2020  路  1Comment  路  Source: wojtekmaj/react-calendar

I'm not sure! Is there a config to only show weekdays for the calendar (hide weekends)which means showing 5 days calendar (Mon-Fri).

If there isn't any then, is there a way to achieve it.

Any ideas?

question

Most helpful comment

You could use tileClassName to pass a class name that hides a tile to weekend tiles.

Then, apply the following changes:

/* Make each tile 1/5th of available space in a row, instead of default 1/7th */
.react-calendar__month-view__days > .react-calendar__tile,
.react-calendar__month-view__weekdays__weekday {
  flex-basis: 20% !important;
  max-width: 20% !important;
}

/* Hide weekday labels */
/* Variant 1 - US calendar */
.react-calendar__month-view__weekdays__weekday:nth-child(1), 
.react-calendar__month-view__weekdays__weekday:nth-child(7) {
  display: none;
}

/* Variant 2 - ISO calendar */
.react-calendar__month-view__weekdays__weekday:nth-child(6), 
.react-calendar__month-view__weekdays__weekday:nth-child(7) {
  display: none;
}

obraz

>All comments

You could use tileClassName to pass a class name that hides a tile to weekend tiles.

Then, apply the following changes:

/* Make each tile 1/5th of available space in a row, instead of default 1/7th */
.react-calendar__month-view__days > .react-calendar__tile,
.react-calendar__month-view__weekdays__weekday {
  flex-basis: 20% !important;
  max-width: 20% !important;
}

/* Hide weekday labels */
/* Variant 1 - US calendar */
.react-calendar__month-view__weekdays__weekday:nth-child(1), 
.react-calendar__month-view__weekdays__weekday:nth-child(7) {
  display: none;
}

/* Variant 2 - ISO calendar */
.react-calendar__month-view__weekdays__weekday:nth-child(6), 
.react-calendar__month-view__weekdays__weekday:nth-child(7) {
  display: none;
}

obraz

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Coder2012 picture Coder2012  路  5Comments

fasmart4 picture fasmart4  路  6Comments

andymj picture andymj  路  5Comments

mikeyharris89 picture mikeyharris89  路  4Comments

tranvula picture tranvula  路  4Comments