JTAppleCalendar: didDeselectDate not called due to incorrect startOfMonth / endOfMonth caches

  1. I’m using version 7.1.4
  2. Are you using the latest version of JTAppleCalendar? Latest version is currently 7.1.4

Basically, I’ve got a cell that has a round layer (shown in orange in the GIF) that indicates if the corresponding day is selected or not and I noticed that when I picked two dates from the past month the didSelectedDate method wasn’t called at all.

agbmoia

As you can see, whenever I select the 30th of November, the didDeselectDate method isn’t called. I tried to force the calendar to deselect the cell by adding calendar.deselectDates(from: oldDate) but to no avail.

After investigating, I came to the conclusion that the issue lies in the fact that the startOfMonthCache & endOfMonthCache variables (used in the pathsFromDates method, in the InternalQueryFunctions.swift file) still contained old values - the start and end dates of December, the previous month, instead of the ones belonging to November.

As such, that particular method would return no path at all and the deselect method never gets called in the deselect(dates: [Date] , triggerSelectionDelegate: Bool = true) method further along the line.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (15 by maintainers)

Most upvoted comments

found the reason why. Will work on a fix.