Pretty much, what the title says. I need to make the GWT DatePicker component use Monday as the first day of the week. Currently the day labels are S M T W T F S
If you look at the source code of DefaultCalendarView (which can be provided in the protected constructor of a DatePicker) it uses CalendarUtil's getStartingDayOfWeek to set the default starting day. CalendarUtil
gets the start date from DateTimeConstants
. So, as ju said, it's determined by your locale.
The question is, how do you override the default locale value. To be honest, I don't know how to do this or if it's even possible. That would obviously be the easiest solution.
However, if that's not possible, what you can do is create a class that extends DatePicker
. Then create another class that extends DefaultCalendarView
and overrides the setup
method. Copy over the same method source but change the start date to Monday instead of using the start date from CalendarUtil
. Then create your custom DatePicker
using your custom DefaultCalendarView
. It's a hack, but it should work.