commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chua, Jerson \(Exchange\)" <JC...@Bear.com>
Subject RE: Time bugs Was: [lang] FastDateFormat year bug
Date Mon, 13 Sep 2004 15:15:14 GMT
Hen,

Try this one out.

Update the code in case 'y' into this

if (tokenLen == 2) {
	rule = TwoDigitYearField.INSTANCE;
} else {
	rule = selectNumberRule(Calendar.YEAR, tokenLen); 
}

-----Original Message-----
From: Henri Yandell [mailto:flamefew@gmail.com] 
Sent: Sunday, September 12, 2004 12:48 AM
To: Jakarta Commons Developers List
Subject: Re: Time bugs Was: [lang] FastDateFormat year bug

Actually, I retract this. If it switches to P'y'Y, then it won't print
out 2002 but 02 when it does large durations. I think the 'hack' of
using a DateFormat to format durations is stretched here.

So 2 problems now. Years are broke in ISO_EXTENDED and dates are broke
in FastDateFormat.

Hen


On Sun, 12 Sep 2004 00:40:51 -0400, Henri Yandell <flamefew@gmail.com>
wrote:

> testISODurationFormat:
>         // test fixture from example in
> http://www.w3.org/TR/xmlschema-2/#duration
>         cal.set(1, 1, 3, 10, 30, 0);
>         cal.set(Calendar.MILLISECOND, 0);
>         text = DurationFormatUtils.ISO_EXTENDED_FORMAT.format(cal);
>         assertEquals("P1Y2M3DT10H30M0.0S", text);
> 
> This is, I believe, a bug in our pattern:
> 
> ISO_EXTENDED_FORMAT_PATTERN = "'P'yyyy'Y'M'M'd'DT'H'H'm'M's.S'S'"
> 
> should be:
> 
> ISO_EXTENDED_FORMAT_PATTERN = "'P'y'Y'M'M'd'DT'H'H'm'M's.S'S'"

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org




***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation, 
offer or agreement or any information about any transaction, customer 
account or account activity contained in this communication.
***********************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message