Skip to content

Modifiers to match day of the week #330

@gpbl

Description

@gpbl

We can extend the type of modifiers to accept days of the weeks.

A common case is to match all the Sundays. This can be done using a function:

const sunday = day => day.getDate() === 0 
<DayPicker disabledDays={ sunday } />

Instead, we should be able to write:

// Disable Sundays
<DayPicker disabledDays={{ daysOfWeek: 0 }} />

// Disable Sundays and Saturdays
<DayPicker disabledDays={{ daysOfWeek: [0, 6] }} />
  • implement new modifier type
  • add unit tests
  • update docs
  • update examples
  • update typescript definitions file

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions