First Day of Week
flowhorn opened this issue · 4 comments
Hello,
I really like your work, especially the calendar widget for flutter, as i use it in my app. And it is wonderful. But I would like to have the calendar not starting sunday and ending saturday, but from monday to sunday.
This would be fantastic!
+1
It would be awesome if you could give us an option with which day of the week we would like to start. Thanks for the great work tho!
This is already a fantastic proyect, but having this option woudl be amazing.
Yes! For weekly calendar it should start from Monday, then only it will be useful. lot of other calendar providers doing that otherwise integrations will become tough.
Set firstWeekday = 1 in DateModel
and replace following code
func indexAtBeginning(in month: MonthType) -> Int?{ if let index = calendar.ordinality(of: .day, in: .weekOfMonth, for: atBeginning(of: month)) { let finalIndex = index - 2 if finalIndex < 0{ return 7 + finalIndex // + because final index is in negative } return finalIndex } return nil }