Kirk Backus
Kirk Backus

Reputation: 4866

GWT DatePicker Change In 2.5.1

Background

In GWT 2.5.0 in the file: com.google.gwt.i18n.client.impl.cldr.DateTimeFormatInfoImpl_en defines getFirstDayOfWeek as:

@Override
public int firstDayOfTheWeek() {
    return 0;
}

This causes the Calendar to render as SMTWTFS

But in the update GWT 2.5.1 this was changed to

@Override
public int firstDayOfTheWeek() {
   return 1;
}

Causes the calendar to render as MTWTFSS.


The Question(s)

Does anybody know why the default changed? I'm not really excited to go back and change all of my calendars!

Does anybody know of a locale I can change to so the calendar renders as SMTWTFS? I would prefer not to create a subclass, override the firstDayOfTheWeek() and change all of the calendars.

Upvotes: 3

Views: 259

Answers (1)

xsee
xsee

Reputation: 1163

I am not prepared to test this solution but you might try using GWT Deferred Binding. If it works then the benefit is that you don't have to change a ton of code.

1: Create a new class and override the firstDayOfTheWeek() method.

public class CustomDateTimeFormatInfoImpl_en extends DateTimeFormatInfoImpl_en {

    @Override
    public int firstDayOfTheWeek() {
        // make Sunday my first day of the week
        return 0;
    }
}

2: Add a deferred binding directive in your gwt.xml module file.

<replace-with class="com.example.sample.CustomDateTimeFormatInfoImpl_en">
    <when-type-is class="com.google.gwt.i18n.client.impl.cldr.DateTimeFormatInfoImpl_en"/>
</replace-with>

Hope that helps or at least leads you in the right direction.

Upvotes: 1

Related Questions