Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion EPCalendar/EPCalendarPicker/EPCalendarPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class EPCalendarPicker: UICollectionViewController {

// new options
public var startDate: NSDate?
public var endDate: NSDate?
public var hightlightsToday: Bool = true
public var hideDaysFromOtherMonth: Bool = false
public var barTintColor: UIColor
Expand Down Expand Up @@ -221,13 +222,19 @@ public class EPCalendarPicker: UICollectionViewController {
if currentDate.isToday() && hightlightsToday {
cell.setTodayCellColor(todayTintColor)
}

if startDate != nil {
if NSCalendar.currentCalendar().startOfDayForDate(cell.currentDate) < NSCalendar.currentCalendar().startOfDayForDate(startDate!) {
cell.isCellSelectable = false
cell.lblDay.textColor = self.dayDisabledTintColor
}
}
if endDate != nil {
if NSCalendar.currentCalendar().startOfDayForDate(cell.currentDate) > NSCalendar.currentCalendar().startOfDayForDate(endDate!) && startDate! < endDate! {
cell.isCellSelectable = false
cell.lblDay.textColor = self.dayDisabledTintColor
}
}
}
}
else {
Expand Down