JTAppleCalendar icon indicating copy to clipboard operation
JTAppleCalendar copied to clipboard

indates showing nil when scrolling into certain previous months

Open DrD00der opened this issue 4 years ago • 2 comments

Using latest build, 8.0.2, and having an error where certain months will not pull the indate properly. This happens consistently when scrolling back from January 2020 to December 2019. If I continue to scroll back months, November and October load the indates normally, and then September 2019 has a nil indate as well. There seems to be no problem with outdates or when scrolling into future months.

I was using the indates to pull data from my database so my app crashes once I scroll back into those months.

Any suggestions or other data I can add to help investigate?

My didScrollToDateSegment function:

func calendar(_ calendar: JTACMonthView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo) {
    setupViewsOfCalendar(from: visibleDates)

    guard activeMonth != currentMonth else {
        print("current month, no need to check for scroll dates update")
        monthLabel.text = monthLabelText + ": " + countMonthTotals(appointments: monthAppt)
        return
    }
    
    print("scrolled indate = \(visibleDates.indates.first?.date)").  //sometimes this results in nil
    print("scrolled outdate = \(visibleDates.outdates.last?.date)")
  
   ...other things done with calendar
    }

DrD00der avatar Jan 06 '20 17:01 DrD00der

More information, I added a print(visibleDates) check to see the full data being pulled and confirm no indates array is pulling on the months in question:

DateSegmentInfo(indates: [], monthDates: [(date: 2019-12-01 08:00:00 +0000, indexPath: [5, 0]), (date: 2019-12-02 08:00:00 +0000, indexPath: [5, 1]), (date: 2019-12-03 08:00:00 +0000, indexPath: [5, 2]), (date: 2019-12-04 08:00:00 +0000, indexPath: [5, 3]), (date: 2019-12-05 08:00:00 +0000, indexPath: [5, 4]), (date: 2019-12-06 08:00:00 +0000, indexPath: [5, 5]), (date: 2019-12-07 08:00:00 +0000, indexPath: [5, 6]), (date: 2019-12-08 08:00:00 +0000, indexPath: [5, 7]), (date: 2019-12-09 08:00:00 +0000, indexPath: [5, 8]), (date: 2019-12-10 08:00:00 +0000, indexPath: [5, 9]), (date: 2019-12-11 08:00:00 +0000, indexPath: [5, 10]), (date: 2019-12-12 08:00:00 +0000, indexPath: [5, 11]), (date: 2019-12-13 08:00:00 +0000, indexPath: [5, 12]), (date: 2019-12-14 08:00:00 +0000, indexPath: [5, 13]), (date: 2019-12-15 08:00:00 +0000, indexPath: [5, 14]), (date: 2019-12-16 08:00:00 +0000, indexPath: [5, 15]), (date: 2019-12-17 08:00:00 +0000, indexPath: [5, 16]), (date: 2019-12-18 08:00:00 +0000, indexPath: [5, 17]), (date: 2019-12-19 08:00:00 +0000, indexPath: [5, 18]), (date: 2019-12-20 08:00:00 +0000, indexPath: [5, 19]), (date: 2019-12-21 08:00:00 +0000, indexPath: [5, 20]), (date: 2019-12-22 08:00:00 +0000, indexPath: [5, 21]), (date: 2019-12-23 08:00:00 +0000, indexPath: [5, 22]), (date: 2019-12-24 08:00:00 +0000, indexPath: [5, 23]), (date: 2019-12-25 08:00:00 +0000, indexPath: [5, 24]), (date: 2019-12-26 08:00:00 +0000, indexPath: [5, 25]), (date: 2019-12-27 08:00:00 +0000, indexPath: [5, 26]), (date: 2019-12-28 08:00:00 +0000, indexPath: [5, 27]), (date: 2019-12-29 08:00:00 +0000, indexPath: [5, 28]), (date: 2019-12-30 08:00:00 +0000, indexPath: [5, 29]), (date: 2019-12-31 08:00:00 +0000, indexPath: [5, 30])], outdates: [(date: 2020-01-01 08:00:00 +0000, indexPath: [5, 31]), (date: 2020-01-02 08:00:00 +0000, indexPath: [5, 32]), (date: 2020-01-03 08:00:00 +0000, indexPath: [5, 33]), (date: 2020-01-04 08:00:00 +0000, indexPath: [5, 34]), (date: 2020-01-05 08:00:00 +0000, indexPath: [5, 35]), (date: 2020-01-06 08:00:00 +0000, indexPath: [5, 36]), (date: 2020-01-07 08:00:00 +0000, indexPath: [5, 37]), (date: 2020-01-08 08:00:00 +0000, indexPath: [5, 38]), (date: 2020-01-09 08:00:00 +0000, indexPath: [5, 39]), (date: 2020-01-10 08:00:00 +0000, indexPath: [5, 40]), (date: 2020-01-11 08:00:00 +0000, indexPath: [5, 41])])

DrD00der avatar Jan 06 '20 17:01 DrD00der

sorry for the late reply. can you provide me with a sample project for this? Please make the project as empty as possible to concisely show the error.

What i will dois --> put a breakpoint at the point the date is nil, and then go back up the stack to see where the issue is.

patchthecode avatar Jan 15 '20 01:01 patchthecode