[ZCM] [ZC] 778/ 2 Comment "DateTime() return wrong object"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin@zope.org
Sun, 19 Jan 2003 23:42:09 -0500


Issue #778 Update (Comment) "DateTime() return wrong object"
 Status Pending, Zope/bug medium
To followup, visit:
  http://collector.zope.org/Zope/778

==============================================================
= Comment - Entry #2 by ajung on Jan 19, 2003 11:42 pm

Works for me with the latest 2.6 checkout (RH 8.0).

________________________________________
= Request - Entry #1 by Anonymous User on Jan 19, 2003 9:26 pm

This is an interesting bug because it can only be reproduced with the following set of commands in a python script.

 dummy_date = DateTime('2002-01-01')
 print dummy_date.day()
 print dummy_date.timeTime()
 test_date = DateTime(dummy_date.timeTime())
 print test_date.day()
 print test_date.timeTime()
 return printed

If you do this you will notice two different dates returned with the same timeTime() value. This will happen anytime you define a DateTime object without a time.

I have managed to work around this in my scripts by adding a time to the DateTime declaration:

 dummy_date = DateTime('2002-01-01 00:00:01')

When you do this the problem goes away.
==============================================================