Search code examples
iosswiftdatefscalendar

Close past dates in FSCalendar


I use FSCalendar and i'm trying to close past dates, but i or close the whole calendar for selecting dates or open all dates to select.

How i can close only past dates from today's date?

This should be done in this method:

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


}

I have found a lot of answers on this subject, but nowhere answer how to write code.


Solution

  • The simple way is you can set minimum date method on **FSCalendarDataSource*

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