Reputation: 731
How to set the first date of the week to Wednesday and show the first and last date of week on yellow bar? Because the schedule will update every Wednesday.
Upvotes: 1
Views: 1033
Reputation: 7485
Please check this might help :
var calendar = Calendar.current
calendar.firstWeekday = 4
let startOfWeek = calendar.date(from: calendar.dateComponents([.yearForWeekOfYear, .weekOfYear], from: Date()))!
let endOfWeek = calendar.date(byAdding: .day, value: 6, to: startOfWeek)!
print(startOfWeek)
print(endOfWeek)
Upvotes: 1