JTAppleCalendar
JTAppleCalendar copied to clipboard
Able to multiple selections after `reloadData()`
(Required) Version Number: 8.0.3
Description
Demo: Demo Project
After reloadData()
called, the calendar can be highlighted with multiple dates, even already disabled multiple selections.
Steps To Reproduce
1, Run the demo project 2, Selected someday outside the current month (such as Nov 3) 3, Click the table row to open a detail page. 4, Go back and click another day outside of the current month (such as Nov 4) 5, Observe, the 3rd and 4th are both highlighted.
Expected Behavior
Only the new selected day should be highlighted, in this case, the Nov 4th.
Additional Context
Testing on 7.1.8, there's no issue.
OK. I'll take a look after work today.
Just got time. Taking a look at this now.
Are you still experiencing this? and if so, what version of XCode are you using? Im currently on XCode12 and every thing looks fine.
The only clue that I have based on what you have said, is that
it works well on version 7.1.8
This lets me think that you have probably upgraded. If this is the case, then maybe your deselect/select function name needs to be updated?
I have the migration guide over here where I show all the names of the function that has been changed. --> https://patchthecode.com/jtapplecalendar-version-8-0-0-migration-guide/
Apologies for the late reply, but time in 2020 is a bit hard to come by for me. Let me know if this is the issue
Hi @patchthecode , I'm still seeing this error. And if you see my demo (The commented code is for version 7): https://github.com/dabaicaifen/CalendarDemo/blob/main/CalendarDemo/Sources/Controllers/ViewController.swift.
I'm using the correct delegate methods. I'm using Xcode 12.2 right now, but when I create this demo, I think I'm using Xcode 12 or 12.0.1.
The key step to reproduce this error is setting the current date as Oct 23.
Hey @patchthecode I am also facing this issue.
I'm also seeing this issue on v8.0.3. To test I implemented the select and deselect delegate callbacks:
func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
func calendar(_ calendar: JTACMonthView, didDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
In some cases didSelectDate
was invoked without a corresponding didDeselectDate
, which resulted in calendar.selectedDates.count == 2
. Continuing to select different dates would eventually resolve the issue and the calendar would return to just having 1 date selected. As a workaround, I was able to manually deselect the extra dates:
func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {
calendar.deselect(dates: calendar.selectedDates.filter { $0 != date })
...
}
But this does appear to be a library issue.
Hi @jvisenti , I just tried your solution on the demo project that I had attached with this issue https://github.com/dabaicaifen/CalendarDemo. The workaround is not working in my case.