material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[MaterialDatePicker] Option to set the start day of the week

Open jmartingit opened this issue 5 years ago • 3 comments

Is your feature request related to a problem? Please describe. In my app, I allow users to select the initial day of the week (Saturday, Sunday or Monday). I observed that MaterialDatePicker (version 1.3.0-beta01) sets the start of the week depending on the locale, but that may not always be the case for my users.

Describe the solution you'd like An option to set the initial day of the week when building the picker.

Describe alternatives you've considered Currently, I need to use an external library to achieve this.

Note I just want to congratulate the whole team for the awesome work you're doing with this library. Your work is really appreciated.

jmartingit avatar Dec 22 '20 17:12 jmartingit

@jmartingit Could you describe which external library helps you achieve this requirement?

mtotschnig avatar Aug 20 '21 07:08 mtotschnig

This is the library I'm using: https://github.com/wdullaer/MaterialDateTimePicker

jmartingit avatar Aug 20 '21 08:08 jmartingit

Would love to this feature as well. Something similar to the DatePickerDialog:

val picker = DatePickerDialog(requireContext())
picker.datePicker.firstDayOfWeek = Calendar.MONDAY
...

apouche avatar Sep 02 '22 12:09 apouche

Since 1.7.0 there's a hidden setFirstDayOfWeek function in the CalendarConstraints.Builder, see: https://github.com/material-components/material-components-android/blob/release-1.7/lib/java/com/google/android/material/datepicker/CalendarConstraints.java#L337

Dunno why it's still kept hidden when support for first week of day has been implemented since the initial release, see: https://github.com/material-components/material-components-android/blob/release-1.1/lib/java/com/google/android/material/datepicker/DaysOfWeekAdapter.java

Please make it official.

henrik-lindqvist avatar Oct 27 '22 16:10 henrik-lindqvist