I need to get date like "31 of January - 6 of February"
I used next code:
let calendar = Calendar(identifier: .gregorian)
let dateFormatter = DateFormatter()
let weekday = 1
let sundayComponents = DateComponents(calendar: calendar, weekday: weekday)
let nextSunday = calendar.nextDate(after: Date(), matching: sundayComponents, matchingPolicy: .nextTimePreservingSmallerComponents)
I need to take all this period from Monday to Sunday
question from:https://stackoverflow.com/questions/65908191/start-and-end-date-of-next-week-swift