Needs work. There is a discrepancy between the documentation and the proposed implementation. For example for year 1996 and "yyyyy" the documentation says "01996" should be printed. But the proposed fix would print "1996" instead as it only pads "yyyy" patterns. Zero padding by default (that is, for anything other than "yy") would provide a behavior according to the documentation. Otherwise, let's fix the documentation to match the implementation.
http://gwt-code-reviews.appspot.com/433801/diff/1/2 File user/src/com/google/gwt/i18n/client/DateTimeFormat.java (right): http://gwt-code-reviews.appspot.com/433801/diff/1/2#newcode192 user/src/com/google/gwt/i18n/client/DateTimeFormat.java:192: * produces <code>"06"</code>). Year is handled specially; that is, if the count Either document the handling of yyyy (padding with zeroes) or extend the handling to any number of y's http://gwt-code-reviews.appspot.com/433801/diff/1/2#newcode338 user/src/com/google/gwt/i18n/client/DateTimeFormat.java:338: * <td><code>"yyyyy.MMMMM.dd GGG hh:mm aaa"</code></td> According to the code in formatYear it would seem that this example differs from the implementation. Formatting "yyyyy" produces "1996" instead of "01996". http://gwt-code-reviews.appspot.com/433801/diff/1/2#newcode1189 user/src/com/google/gwt/i18n/client/DateTimeFormat.java:1189: * should be formatted Document the two special cases 2 and 4. Does 4 need to be a special case? http://gwt-code-reviews.appspot.com/433801/diff/1/2#newcode1202 user/src/com/google/gwt/i18n/client/DateTimeFormat.java:1202: // count != 2 Should this become "count != 2 && count != 4"? http://gwt-code-reviews.appspot.com/433801/diff/1/2#newcode1203 user/src/com/google/gwt/i18n/client/DateTimeFormat.java:1203: buf.append(value); Perhaps a better option would be to zero pad by default. Then, a single 'y' would perform an append and everything else would pad as expected (with "yy" being a special case, as documented above). http://gwt-code-reviews.appspot.com/433801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors