Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change first day of week start from Monday #496

Closed
rensamatar opened this issue Dec 1, 2019 · 1 comment
Closed

How to change first day of week start from Monday #496

rensamatar opened this issue Dec 1, 2019 · 1 comment

Comments

@rensamatar
Copy link

I need to change first day of the week from Sunday to Monday. Where I can edit the code.

@rensamatar rensamatar changed the title How to change first day of week from Monday How to change first day of week start from Monday Dec 1, 2019
@dandragut
Copy link

dandragut commented Nov 17, 2021

It seems to be controlled by locale used which you can pass to the library:

Locale locale = new Locale("en", "GB");
CalendarPickerView calendarPickerView = view.findViewById(R.id.calendar_view);
calendarPickerView.init(minDate, maxDate, locale)
      ...;

Or if you want to change the library, see CalendarPickerView.getMonthCells()

  List<List<MonthCellDescriptor>> getMonthCells(MonthDescriptor month, Calendar startCal) {
    Calendar cal = Calendar.getInstance(timeZone, locale);
    ...
    int firstDayOfWeek = cal.get(DAY_OF_WEEK);
    int offset = cal.getFirstDayOfWeek() - firstDayOfWeek;
    if (offset > 0) {
      offset -= 7;
    }
    ...

@edenman edenman closed this as completed Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants