react-modern-calendar-datepicker
react-modern-calendar-datepicker copied to clipboard
Disable a day or a set of days for whole calendar
Is there a way to disable a day or multiple days for the whole calendar? I'm working on showing slots for specific day and there are some days that are not available for booking So I was wondering if we can disable a day like Monday for whole calendar.
the Behaiver U want as Define the dates that can be selected. The function receives (currentDate, selectedDate) and should return a true or false whether the currentDate is valid or not
isValidDate?: (currentDate: any, selectedDate: any) => boolean; u can add it to your Date calnder and add to the calnder Cpmponent isValidDate={validDate} this should return false for specfic day and true for the other const validDate = current => current.day() !== 0 while week start at sun from 0 so here sunday is not a valid date and it's disabled
i hope it helps
I'm using Calendar component and there a prop for disabledDays
which accepts an array of individual dates to be disabled
https://github.com/Kiarash-Z/react-modern-calendar-datepicker/blob/0cd7478b2fda3f755f0128a2ba1244346ed9eba0/src/Calendar.js#L162
I can't find this isValidDate
prop with this Calendar component.
I'm using Calendar component and there a prop for
disabledDays
which accepts an array of individual dates to be disabledhttps://github.com/Kiarash-Z/react-modern-calendar-datepicker/blob/0cd7478b2fda3f755f0128a2ba1244346ed9eba0/src/Calendar.js#L162
I can't find this
isValidDate
prop with this Calendar component.
i told u mate u can add logic like it in ur package it self wihout damage ur package
you can make a helper fuction to do it for u , any way i requested that featuer the day before i hope they add it
This would be a great feature. Writing custom functionality for this doesn't make sense, and you'd have to calculate it from now until the end of time.
I have created a pull requests that contains a feature to disable specific week days and to forcely enable specific calendar days.
For example: disable every monday and friday and then enable a specific date (like monday, even though mondays are disabled via that disabledWeekDays
feature.
#224
any updates on this ?