DateTime parsing assumes "US" style mm/dd/yyyy

Bug #1045233 reported by Chui Tey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zope 2
Fix Released
Undecided
Unassigned

Bug Description

The parsing heuristics assume that if a date time looks like this "11-01-2001", then it is November 11.
Actually at non-US sites, it is 11th of January.

--- a/Lib/site-packages/datetime-2.12.6-py2.7.egg/DateTime/DateTime.py
+++ b/Lib/site-packages/datetime-2.12.6-py2.7.egg/DateTime/DateTime.py

@@ -984,8 +986,12 @@ class DateTime:
                         month=ints[1]

             elif ints[0] <= 12:
- month=ints[0]
- day=ints[1]
+ if datefmt=="us":
+ day=ints[1]
+ month=ints[0]
+ else:
+ day=ints[0]
+ month=ints[1]
                 year=ints[2]
             del ints[:3]

Revision history for this message
Lennart Regebro (regebro-gmail) wrote :

This looks like it's already fixed in DateTime 3.0.

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

I fixed this on DateTime trunk (what will be 3.0.2). A different code path was taken there and it didn't respect the datefmt setting.

Changed in zope2:
milestone: none → 2.13.19
status: New → Fix Committed
Revision history for this message
Hanno Schlichting (hannosch) wrote :

Released as part of DateTime 3.0.2, first included into the Zope 4 release line.

Changed in zope2:
milestone: 2.13.19 → 4.0a1
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.