Glow-Inc / GLCalendarView

A fully customizable calendar view acting as a date range picker
MIT License
855 stars 106 forks source link

Option to disable ability to pick days in the past #5

Closed lukehook closed 9 years ago

lukehook commented 9 years ago

If minimum date is set to today but falls on a day other than a sunday it is still possible to pick a date in the past. Possibility to 'grey out' and/or disable selecting of past dates on show?

ltebean commented 9 years ago

if you want to disallow user to add a range in past days, you can implement this delegate method:

- (BOOL)calenderView:(GLCalendarView *)calendarView canAddRangeWithBeginDate:(NSDate *)beginDate;

just return No if beginDate is past days

if you want to make the date ranges in past days not selectable, you can construct the GLCalendarDateRange instance as:

GLCalendarDateRange *range = [GLCalendarDateRange rangeWithBeginDate:beginDate endDate:endDate];
range.backgroundColor = COLOR_GREY; // grey out
range.editable = NO; // disallow user to select it