JZDatepicker icon indicating copy to clipboard operation
JZDatepicker copied to clipboard

selectDate at index throws error

Open rajesh-esaver opened this issue 3 years ago • 0 comments

I want to load the calendar with 14 days(one week to the past and one week to the future) and I'm using the below code to do it. This works fine, but when the current date is the month beginning I'm getting crash with the below error.

Attempted to scroll the collection view to an out-of-bounds item (7) when there are only 7 items in section 0

var prevDate = Date()
prevDate.changeDays(by: -7)
datePicker.fillDates(from: prevDate, numberOfDays: 14)
datePicker.selectDate(at: 7)

rajesh-esaver avatar Feb 02 '22 09:02 rajesh-esaver