Skip to content

Commit

Permalink
Crash
Browse files Browse the repository at this point in the history
Crash on using NSDate() without a formatter for date ranges #11

Under configure calendar, if I make date ranges using NSDate():

let currentDate = NSDate()
let startComponents = NSDateComponents
let startDate = calendar.dateByAddingComponents(startComponents, toDate: currentDate, options: NSCalendarOptions())
let endComponents = NSDateComponents()
endComponents.month = 1
let endDate = calendar.dateByAddingComponents(endComponents, toDate: currentDate, options: NSCalendarOptions())

I'm getting this error

2016-04-29 17:38:30.217 MyApp[81989:679927] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'attempt to scroll to invalid index path: <NSIndexPath: 0x7b073180> {length = 2, path = 0 - 0}'
  • Loading branch information
patchthecode committed Apr 30, 2016
1 parent 20cb566 commit 28f8ef1
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 85 deletions.
4 changes: 2 additions & 2 deletions Example/JTAppleCalendar/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ extension ViewController: JTAppleCalendarViewDataSource, JTAppleCalendarViewDele
endDateComponents.month = 1
let secondDate = NSCalendar.currentCalendar().dateByAddingComponents(endDateComponents, toDate: today, options: NSCalendarOptions())

let calendar = NSCalendar.currentCalendar()
let aCalendar = NSCalendar.currentCalendar() // Properly configure your calendar to your time zone here

return (startDate: firstDate!, endDate: secondDate!, calendar: calendar)
return (startDate: firstDate!, endDate: secondDate!, calendar: aCalendar)
}

func calendar(calendar: JTAppleCalendarView, isAboutToDisplayCell cell: JTAppleDayCellView, date: NSDate, cellState: CellState) {
Expand Down
Loading

0 comments on commit 28f8ef1

Please sign in to comment.