[Zope] Datetime bug in Zope-2.7.6?

Luiz Fernando luiz at engenhosolucoes.com.br
Mon Jun 13 23:17:19 EDT 2005


Dennis Allison escreveu:

>Zope 2.7.6
>Python 2.4.1 (and yes, I know I am jumping the gun a bit)
>
>The problem appears to be in the parse component -- 
>
>Consider a test script:
>
>for y in range(1995,2005):
>    for d in (1, 3, 13, 25,):
>        for m in (1,4,5,6,):
>             dd = '%d-%02d-%02d' % (y,m,d,)
>             ee  = '%d/%d/%d' % (m, d, y)
>             D  = DateTime(dd)
>             E  = DateTime(ee)
>             print dd, D.strftime('%Y-%m-%d')
>             print ee, E.strftime('%Y-%m-%d')
>return printed
>
>In all cases, each of the dates shoudl be the same.  As can be seen,
>for dates sourced from a string of the form
>
>1995-04-25
>
>the resulatant date is off by one day
>
>1995-04-24
>
>The problem is not seen with Zope 2.6.4 running with 
>Python 2.3.5.
>
>A quick diff shows tht there are many changes between 2.6 and 2.7.
>Anyone else seen this problem?
>
>------------------------------------
>Partial Results:
>
>1995-04-25 1995-04-24
>4/25/1995 1995-04-25
>
>1995-05-25 1995-05-24
>5/25/1995 1995-05-25
>
>1995-06-25 1995-06-24
>6/25/1995 1995-06-25
>
>  
>
Yes it happes to me also every time I use strftime, so I stopped using it.
Someone posted a patch to fix this in this list not a long ago.
I think this is a problem of interpretation on how the default behavior 
should be as these dates do not have any Timezone information.

But I would prefer zope to work the same as python itself, that works as 
expected.

Luiz Fernando B. Ribeiro



More information about the Zope mailing list