VACalendar icon indicating copy to clipboard operation
VACalendar copied to clipboard

Delegate method "selectedDate(_ date: Date)" not called, if a day already selected.

Open ATrotsenko opened this issue 6 years ago • 2 comments

I can't get a date, if a day already selected. I think, nothing will be break if the method calendarDelegate?.selectedDate?(day.date) will call before the line guard day.state == .available else { return }

original code: ` extension VACalendarView: VAMonthViewDelegate {

func dayStateChanged(_ day: VADay, in month: VAMonth) {
    switch selectionStyle {
    case .single:
        guard day.state == .available else { return }
        
        calendar.deselectAll()
        calendar.setDaySelectionState(day, state: .selected)
        calendarDelegate?.selectedDate?(day.date)
        
    case .multi:
        calendar.setDaySelectionState(day, state: day.reverseSelectionState)
    }
}

}`

ATrotsenko avatar Jan 05 '19 16:01 ATrotsenko

Hello ATrotsenko,

Comment below line from your code.

// guard day.state == .available else { return } // comment for click same date

// calendar.deselectAll() // calendar.setDaySelectionState(day, state: .selected) // calendarDelegate?.selectedDate?(day.date)

tusharMistri avatar Jan 19 '19 05:01 tusharMistri

STUCKED ON SAME.

by the way this upper suggestion is working,

do change in VACalendarView-

comment - // guard day.state == .available else { return } and you will get action on selected date.

BhaviDevIOS avatar Aug 21 '19 08:08 BhaviDevIOS