[zope2-tracker] [Bug 1045233] [NEW] DateTime parsing assumes "US" style mm/dd/yyyy

Chui Tey teyc at cognoware.com
Mon Sep 3 09:25:03 UTC 2012


Public bug reported:

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]

** Affects: zope2
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.
https://bugs.launchpad.net/bugs/1045233

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/zope2/+bug/1045233/+subscriptions


More information about the zope2-tracker mailing list