[Zope] Still. Zope date datatype and TimeZone formatting problems.

Felipe Barousse Boue fbarousse at piensa.com
Wed May 25 21:03:42 EDT 2005


Andreas/Tino: 

Thanks for your replies regarding this date and timezones issue. (Thanks
Dieter Maurer for previous opinions also)

It has been a long and tedious problem to chase and debug, here it goes
what I have narrowed so far:

Let's forget about the undelying DA, the database has nothing to do with
it.

The same problem happens when:  

1) Using _.DateTime(datestring) 
2) The datestring has minus-sign as year, month, date separators.
3) A format is applied, like fmt="%d DE %B %Y"

The following are examples when viewing a DTML Document containing :

<dtml-var "_.DateTime('2005-05-25')"><br>

<dtml-var "_.DateTime('2005/05/25')" fmt="%d DE %B %Y" upper><br>

<dtml-var "_.DateTime('2005-05-25')"><br>

<dtml-var "_.DateTime('2005-05-25')" fmt="%d DE %B %Y" upper><br>

Output is:

2005/05/25
25 DE MAYO 2005
2005/05/25
24 DE MAYO 2005

Look at the last one 24 DE MAYO 2005, that is wrong !


In the last case, Zope assumes the date to be at midnight GMT and then,
when I apply the formatting (fmt="%d DE %B %Y") it substracts 5 hours
from GMT to get to my local timezone, resulting the date is 1 day off
the real date.

I think Zope should not assume that a date is in any particular time
zone, nor in midnight GMT when using minus-signs as separators, rather
it should take the system's time zone settings into account when
applying datetime formatting. Therefore, if there's the need to use
dashes, there should be no reason to explicit state a time zone when the
user is only entering a simple date (year, month, day).

In other words, why using dashes is acting like a bug, instead of
working like the first casem using "/" as separator ?

Guess I hit the jackpot with a Zope bug...who agrees?

Your comments are appreciated, thanks in advance. !

Felipe

On Mon, 2005-05-23 at 07:08 +0200, Andreas Jung wrote:
> 
> --On Sonntag, 22. Mai 2005 13:01 Uhr -0500 Felipe Barousse Boue 
> <fbarousse at piensa.com> wrote:
> >
> > I have noticed that Zope, when getting the data coming from postgresql
> > (the date) always takes it to be at midnight in GMT time zone.
> >
> > I believe it is still a huge bug the the Zope/Python date time handling
> > routines, I am correct with this appreciation?
> 
> 
> I am pretty sure that this is a problem of the underlaying DA (ZPsycopgDA)
> or the under-underlaying psycopg Python module. DateTime instances are 
> generated
>  by DA from the data coming out of the database...so I would look there and 
> maybe
> check with the author of the DA. So try to search the solution from the 
> bottom
> and not from the top.
> 
> -aj
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope/attachments/20050525/a33dd6d2/attachment.bin


More information about the Zope mailing list