Hi I wanted to share this with you as I thought it might be useful to someone. Its not an issue and don't think its big enough to for a pull request.
With this in swift you can make calendar only selectable in the past.
func calendar(calendar: FSCalendar, shouldSelectDate date: NSDate) -> Bool {
// dont allow date in future to be selected.
let todayDate = NSDate()
let calendar = NSCalendar.self.currentCalendar()
let components = calendar.components([.Day , .Month , .Year, .Hour, .Minute], fromDate: todayDate)
let year = (components.year)
let month = (components.month)
let day = (components.day)
let todayFigure = (year * 10000) + (month * 100) + day
let selectedComponents = calendar.components([.Day , .Month , .Year, .Hour, .Minute], fromDate: date)
let selectedYear = (selectedComponents.year)
let selectedMonth = (selectedComponents.month)
let selectedDay = (selectedComponents.day)
let selectedFigure = (selectedYear * 10000) + (selectedMonth * 100) + selectedDay
if selectedFigure > todayFigure {
return false
}
return true
}
Hi I wanted to share this with you as I thought it might be useful to someone. Its not an issue and don't think its big enough to for a pull request.
With this in swift you can make calendar only selectable in the past.