Fscalendar: Disable past dates

Created on 18 Jan 2018  路  5Comments  路  Source: WenchaoD/FSCalendar

Hi, how can i disable past dates? In issue https://github.com/WenchaoD/FSCalendar/issues/302 i don't understand what need to do. I try to compare previous date with now date and i get block for all dates in calendar.

Most helpful comment

just like @r00tify said. the simple way is you can set minimum date method on FSCalendarDataSource

func minimumDate(for calendar: FSCalendar) -> Date { return Date() }

All 5 comments

is there anyone here?

You can implement the minimumDate method by conforming to FSCalendarDataSource and return the current date.

Thanks, i resolved problem with this method

func calendar(_ calendar: FSCalendar, shouldSelect date: Date, at monthPosition: FSCalendarMonthPosition) -> Bool {

    let curDate = Date().addingTimeInterval(-24*60*60)

    if date < curDate {
        return false
    } else {
        return true
    }
}

just like @r00tify said. the simple way is you can set minimum date method on FSCalendarDataSource

func minimumDate(for calendar: FSCalendar) -> Date { return Date() }

Hello everyone, talking bout FSCalendarDataSource, why is it the mimumDate and maximumDate functions are not getting called? And while the other dataSource functions are getting triggered?

Was this page helpful?
0 / 5 - 0 ratings