WenchaoD / FSCalendar

A fully customizable iOS calendar library, compatible with Objective-C and Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix date range multiselect

r0otx opened this issue · comments

I'm was make select range how it described here https://stackoverflow.com/questions/49856370/how-to-select-range-fscalendar-in-swift
How I can limit range 1 week?

I was fix it with next code:

            guard let oneWeekLater = currentCalendar.date(byAdding: .weekOfYear, value: 1, to: firstDate!) else {
                return
            }
            
            if date >= oneWeekLater {
                calendar.deselect(firstDate!)
                firstDate = date
                datesRange = [firstDate!]
            }

Maybe I'm was useful