[Zope] DateTime() BUG!
Kai Hofmann
hofmann@isl.org
Tue, 8 May 2001 08:16:15 +0200
> Kai Hofmann writes:
> > the "enddate" I showed in the "pseudo"-code has been defined as an object=
> > s=20
> > property of type "date" - so I assumed the argument is correct - isn't it=
> > ?
> But then the result *IS* correct, too!
>
> If you have, as is you example:
>
> enddate=<todays date without time>
> then
> DateTime().lessThanOrEqual(enddate)
>
> must return "false" most of the day.
>
> As the name suggests: "DateTime" is date *AND* time.
> "lessThanOrEqual" must take both components into account.
>From my point this is not correct, because of the following points:
1) within the enddate there is no time defined - so it is NOT possible to
compare the time - following your argument - the result should be a TYPE
ERROR, because its not possible to compare a date/time pair with a date
2) A date only describes a whole day - so comparing it with a date/time pair
should always result in a compare of the dates only - because the time is
out of interest here (its always within the date range).
3) If you want to ignore point 1) and 2) then you MUST add a time to date
single date - to make the compare work - you can add any time - but it would
only make sense to add 00:00:00 or 23:59:59 as time (start / end of day)
For a lessThanOrEqual it would be usefull to assume 23:59:59 - for a
greaterThanOrEqual it would be usefull to assume 00:00:00
So your argument is not acceptable for me - sorry.
Btw. for more about calendrical and time calculation have a look at my site at
http://www.datelib.de/
Greetings
Kai
--
Hofmann Software Engineering International http://www.hofmann-int.de/
Dipl.-Inform. Kai Hofmann mailto:hofmann@hofmann-int.de
Arberger Heerstr. 92 phone:+49 174 1419312
D-28307 Bremen/Germany fax:+49 421 4899933-1