Browse DateIndex Broken for edge cases, displays wrong date

Bug #727981 reported by Elizabeth Leddy
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Zope 2
Fix Released
Low
Unassigned

Bug Description

Running 2.3.15
Test date: 2011-01-01
Part 1: Dates that are in the first month of the year (e.g. 2011-01-01) make the browse index page break because the modulo returns 0, which is then fed to DateTime and barfs.
Part 2: The year is incorrect for the same test date. I see the logic in how its being calculated and I think that this is a precision error, although I didn't spend a lot of time investigating and there is some dubiousness. I tested with a wide range though and the patch seems at least more correct than the current display value.

Patch for both issues will be attached

Revision history for this message
Elizabeth Leddy (eleddy) wrote :
Changed in zope2:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Jim Baack (jbaack) wrote :

Elizabeth-

Thanks for posting - I just ran into the bug too, saw a few very old posts about it and am surprised it isn't yet fixed. I think this version may be slightly more accurate.

Jim

            <dtml-var "DateTime(((_['sequence-key'] - 44640) / 535680),
                                ((_['sequence-key'] - 1440) / 44640 ) % 12 or 12,
                                (_['sequence-key'] / 1440 ) % 31 or 31,
                                (_['sequence-key'] / 60 ) % 24,
                                (_['sequence-key'] ) % 60,
                                0, 'UTC')">

Revision history for this message
Hanno Schlichting (hannosch) wrote :

I committed Jim's patch to ZCatalog trunk.

Changed in zope2:
status: Confirmed → Fix Committed
Revision history for this message
Tres Seaver (tseaver) wrote :

Released with Products.ZCatalog 3.0b2.

Changed in zope2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.