DateTime uses UTC as default Timezone if none given

Bug #378616 reported by Estartu on 2009-05-20
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DateTime
Won't Fix
Undecided
Unassigned

Bug Description

We upgraded our System recently from Zope2.9 to Zope2.11. Under Zope2.9 print DateTime('2009-05-20 12:00:00') returned "2009/05/20 12:00:00 GMT+2" under Zope2.11 it returns "2009/05/20 12:00:00 GMT+0'

I know that there was some work done to get DateTime working with timezones correctly.

I have patched DateTime.py to use the Local Timezone when no timezone is given in iso8601 format.

I have atteched this patch to this Bugreport.

In Order to provide compatibility to the Old behavior the patch can be activated with a zope.conf directive.

Estartu (schmidt-ze) wrote :
Lennart Regebro (regebro-gmail) wrote :

Well... isn't this because it now supports timezone naive datetimes? In which case the new behaviour makes sense?
In any case I think it's a bad idea to have this a configuration setting. You'll change the way othe peoples software behaves. A parameter is better in that case.

I also think fiddling with DateTime is a generally bad idea. DateTime is a dead end, we should only change it if it has proper bugs, not because we want a different type of behaviour.

Lennart Regebro wrote:
> Well... isn't this because it now supports timezone naive datetimes? In which case the new behaviour makes sense?
> In any case I think it's a bad idea to have this a configuration setting. You'll change the way othe peoples software behaves. A parameter is better in that case.
>
> I also think fiddling with DateTime is a generally bad idea. DateTime is
> a dead end, we should only change it if it has proper bugs, not because
> we want a different type of behaviour.

This is the 2.9 behavior. And by the way the default is off. So nothing
changes unless you set the option to on.

There are so many old systems out there where even finding all places where
Datetime is used without timezone is a very time consuming task. These
people can that this option to get there systems Running.

--
-------------------------------------------------
Gerhard Schmidt | E-Mail: <email address hidden>
TU-München |
WWW & Online Services |
Tel: 089/289-25270 |
Fax: 089/289-25257 | PGP-Publickey auf Anfrage

Ricardo Alves (igbun) wrote :

I also having this problema, or at least seems to be somehow related. I'm getting this weird behavior: my local timezone is WET (currently GMT+1) and depending on the format of the date string I get different timezones:

>>> DateTime('2010-05-07 08:45:00')
DateTime('2010/05/07 08:45:00 GMT+0')
>>> DateTime('2010-05-07 08:45:00')
DateTime('2010/05/07 08:45:00 GMT+0')
>>> DateTime('07-05-2010 08:45:00')
DateTime('2010/07/05 08:45:00 GMT+1')

Is this behavior expected?

Tres Seaver (tseaver) on 2010-05-07
affects: zope2 → datetime
Tres Seaver (tseaver) wrote :

The documented behavior of DateTime[1] is to use UTC as the default timezone for strings which conform to ISO 8601 format ('YYYY-MM-DD HH:MM:SS'), but the local timezone for any other format.

[1] See the docstring for '_parseArgs' here:

    http://svn.zope.org/DateTime/trunk/src/DateTime/DateTime.py?view=auto

Changed in datetime:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Patches