WenchaoD / FSCalendar

A fully customizable iOS calendar library, compatible with Objective-C and Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thanks a lot @allenhuang but it is working only when I install FSCalendar through pods. When I added FSCalendar manually in my project it throws an error stating Calculator is not a member of calendar. Could you please help me in this regard?

mallikarjuna0308 opened this issue · comments

Hi,
By the hint of monthHead, I finally use the following codes to get visible date range in calendar.

let startDate: Date
let endDate: Date?
if self.calendar.scope == .week {
    startDate = self.calendar.currentPage
    endDate = self.calendar.gregorian.date(byAdding: .day, value: 6, to: startDate)
} else { // .month
    let indexPath = self.calendar.calculator.indexPath(for: self.calendar.currentPage, scope: .month)
    startDate = self.calendar.calculator.monthHead(forSection: (indexPath?.section)!)!
    endDate = self.calendar.gregorian.date(byAdding: .day, value: 41, to: startDate)
}

Originally posted by @allenhuang in #503 (comment)