On Wed, Dec 1, 2010 at 8:46 AM, HerrB92 <[email protected]> wrote:

> I'm sorry, I don't know if there is and this is the right place to
> place an enhancement wish. So, thank you for reading... ;-)
>
> If a parsed date contains only a 2-digit year, then the century will
> be guessed based on the current century +/- 20 years (in short). If
> you format a date, no guessing takes place.
>
> In the current century, people tend to go back to 2-digit typing, as
> the "20" in "2010" shouldn't change in the next 90 years.
>
> The latest fix ensures at least, that formatting a date results in the
> specified digit count. But "10" will become "0010" with a "yyyy"
> pattern. This is the documented result - but may not be expected by
> the users.
>
> Wish:
> Add a parameter to formatYear() (and thus to format()) to guess the
> century, if a 2-digit year and - to keep it simple - a 4-digit-year
> pattern is provided.
>
> E.g. format(<1.1.10>,<guessCentury=true>) -> 01.01.2010, if
> datePattern = "dd.MM.yyyy".
>

I don't think you ever want a Date to have the two-digit year -- things like
which day of the week a date is, leap year or not, etc will all be wrong.
 So, any guessing should only be at the point the date comes into the
system, whether from the user, a database, or whatever.  Then when you
format it for printing, you can choose to use two-digit years if you prefer.

-- 
John A. Tamplin
Software Engineer (GWT), Google

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to