Datetime bug in Zope-2.7.6?
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 -- Dennis Allison * Computer Systems Laboratory * Gates 227 * Stanford University * Stanford CA 94305 * (650) 723-9213 * (650) 723-0033 fax * allison@shasta.stanford.edu * allison@sumeru.stanford.edu
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
--On 14. Juni 2005 00:17:19 -0300 Luiz Fernando <luiz@engenhosolucoes.com.br> wrote:
But I would prefer zope to work the same as python itself, that works as expected.
You mean "datetime"? It is unlikely that this will happen for Zope 2 in the future. -aj
Andreas Jung escreveu:
--On 14. Juni 2005 00:17:19 -0300 Luiz Fernando <luiz@engenhosolucoes.com.br> wrote:
But I would prefer zope to work the same as python itself, that works as expected.
You mean "datetime"? It is unlikely that this will happen for Zope 2 in the future.
-aj
Yes, when using date fields returned from zSQL methods. Extracting the .day .month and .year values works correctly but when you use strftime("%any_format") the resulting date is offset by one day. Luiz Fernando
participants (3)
-
Andreas Jung -
Dennis Allison -
Luiz Fernando