[Zope3-checkins] CVS: Zope3/src/zope/i18n - format.py:1.12

Garrett Smith garrett at mojave-corp.com
Tue Sep 23 22:57:42 EDT 2003


Update of /cvs-repository/Zope3/src/zope/i18n
In directory cvs.zope.org:/tmp/cvs-serv27705/src/zope/i18n

Modified Files:
	format.py 
Log Message:
Fixed a bug that caused 12 hour time formatting to render '12:00' as '00:00'.

=== Zope3/src/zope/i18n/format.py 1.11 => 1.12 ===
--- Zope3/src/zope/i18n/format.py:1.11	Sat Jul 26 09:11:14 2003
+++ Zope3/src/zope/i18n/format.py	Tue Sep 23 22:57:11 2003
@@ -495,6 +495,10 @@
     else:
         ampm = calendar.am
 
+    h = dt.hour%12
+    if h == 0:
+        h = 12
+
     weekday = (dt.weekday()+1) % 7 + 1
 
     return {
@@ -515,8 +519,8 @@
         ('D', 1): dt.strftime('%j'),
         ('w', 1): dt.strftime('%W'),
         ('w', 2): dt.strftime('%.2W'),
-        ('h', 1): str(dt.hour%12),
-        ('h', 2): "%.2i" %(dt.hour%12),
+        ('h', 1): str(h),
+        ('h', 2): "%.2i" %(h),
         ('H', 1): str(dt.hour),
         ('H', 2): "%.2i" %dt.hour,
         ('m', 1): str(dt.minute),




More information about the Zope3-Checkins mailing list