W3C home > Mailing lists > Public > www-jigsaw@w3.org > May to June 2005

Bug report, com.w3c.util.DateParser

From: Brian <ic547@yahoo.com>
Date: Wed, 18 May 2005 06:25:31 +0000
Message-ID: <20050518062521.19601.qmail@web32614.mail.mud.yahoo.com>
To: www-jigsaw@w3.org, jigsaw@w3.org




I tried to send a message to the author of the DateParser class
regarding a possible bug, but I received a delivery failure.  So, I am
hoping this is the correct place to submit the report.  Please see
below...

==============

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es)
failed:

  bmahe@sophia.inria.fr
    (generated from bmahe@w3.org)
    SMTP error from remote mailer after RCPT
TO:<bmahe@sophia.inria.fr>:
    host sophia.inria.fr [138.96.64.20]: 550 5.7.0
<bmahe@sophia.inria.fr>... No such user here


------ This is a copy of the message, including all the headers. ------

Date: Tue, 17 May 2005 23:01:09 -0700
To: bmahe@w3.org
From: Brian <ic547@yahoo.com>
Subject: Bug report, com.w3c.util.DateParser


Greetings.
I am using your DateParser class revision 1.4 from
http://dev.w3.org/cvsweb/java/classes/org/w3c/util/.
Thank you very much for the work.  It is very helpful.
 
In my usage, I believe I may have found a malfunction, but perhaps I am
misunderstanding something.
 
Here is an example of what I have found... 
 
I am parsing this date string using DateParser.parse(String):
    2005-05-17T15:28:11-07:00
 
The returned date appears to be incorrect in the time zone field...

The result of calling toGMTString() on the return value is:
    17 May 2005 08:28:11 GMT
The result of calling toLocaleString() on the return value in the
(-07:00 time zone) is:
    May 17, 2005 1:28:11 AM
 
I noticed that the result was off from what I expected by exactly twice
the time zone value and suspected that the problem could be in the math
of the time zone adjustments.
 
Lines 146 - 152 of the source code are:
146  if (plus) {
147      calendar.add(Calendar.HOUR, tzhour);
148      calendar.add(Calendar.MINUTE, tzmin);
149  } else {
150      calendar.add(Calendar.HOUR, -tzhour);
151      calendar.add(Calendar.MINUTE, -tzmin);
152  }
 
I changed line 146 to:
146  if (!plus) {

This has fixed my problem and the dates now appear to be coming out
correctly.
 
The result of calling toGMTString() on the return value is now:
    17 May 2005 22:28:11 GMT
The result of calling toLocaleString() on the return value in the
(-07:00 time zone) is now:
    May 17, 2005 3:28:11 PM
 
I thought I would report this in case it is a bug in the code.  If not,
and if I am misunderstanding the usage, please advise me of my mistake.
 
Thank you,
Brian



		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 
Received on Wednesday, 18 May 2005 09:47:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:37 GMT