I want to set date limit in JTCalender. As of now it shows dates more than of past year & more than a year ahead of current year. I want to set limit that it should show only dates of past 6 months & future 6 months. I am using swift language. Please suggest how to resolve this issue ?
EDIT: I am using below code in my app also.
func calendarDidLoadNextPage(_ calendar: JTCalendarManager!) {
let formatter = DateFormatter()
formatter.dateFormat = "MMMM yyyy"
print("load next date \(calendar.date())")
label_month.text = formatter.string(from: calendar.date()).uppercased()
filterDate(cal_date: calendar.date())
}
func calendarDidLoadPreviousPage(_ calendar: JTCalendarManager!) {
let formatter = DateFormatter()
formatter.dateFormat = "MMMM yyyy"
print("loading previous date is \(self.dateFormatter().string(from: calendar.date()))")
label_month.text = formatter.string(from: calendar.date()).uppercased()
filterDate(cal_date: calendar.date())
}
You can create Max and Min Date as per your requirement and use JTCalendar's delegate method to limit the date of calendar.
In your Interface
In implementation section, you can do below code.
And A delegate method is there to limit the date for the calendar
The problem is your condition in your delegate method.
You are passing minDate to check isEqualorAfter to your maxDate. which will n ever be true.