2

I am using JTCalender in project.I want to change the order of days displayed.The weekdays starts from Monday and end into Sunday.But i want the weekday from Sunday and end into Monday.Please guide me how can i implement.I am not able to understand how to change it.

TechChain
  • 8,404
  • 29
  • 103
  • 228

1 Answers1

4

You can set the firstDayOfWeek to whichever day you want while configuring the the JTAppleCalendar using the JTAppleCalendarViewDataSource Method:-

func configureCalendar(_ calendar: JTAppleCalendarView) -> ConfigurationParameters {
    let startDate = formatter.date(from: "2016 03 01")!
    let endDate = formatter.date(from: "2020 12 01")!
    var generateInDates: InDateCellGeneration = .forAllMonths
    var generateOutDates: OutDateCellGeneration = .tillEndOfGrid
    let firstDayOfWeek: DaysOfWeek = .sunday
    var numberOfRows = 6
    var testCalendar = Calendar.current

    let parameters = ConfigurationParameters(startDate: startDate,
                                             endDate: endDate,
                                             numberOfRows: numberOfRows,
                                             calendar: testCalendar,
                                             generateInDates: generateInDates,
                                             generateOutDates: generateOutDates,
                                             firstDayOfWeek: firstDayOfWeek)

    return parameters
}

For JTCalendar, you can set the first day of the week using,

[_calendarManager.dateHelper.calendar setFirstWeekday:2]

replace "2" with whichever day you want.

Aakash
  • 2,239
  • 15
  • 23