[Zope3-checkins] CVS: Zope3/src/zope/i18n - format.py:1.6
Stephan Richter
srichter@cbu.edu
Sat, 12 Apr 2003 20:22:12 -0400
Update of /cvs-repository/Zope3/src/zope/i18n
In directory cvs.zope.org:/tmp/cvs-serv23465/src/zope/i18n
Modified Files:
format.py
Log Message:
Found a little bug that caused a failure in formatting dates that are a
Saturday. Fixed it and added a test.
=== Zope3/src/zope/i18n/format.py 1.5 => 1.6 ===
--- Zope3/src/zope/i18n/format.py:1.5 Tue Mar 25 15:03:46 2003
+++ Zope3/src/zope/i18n/format.py Sat Apr 12 20:21:42 2003
@@ -493,6 +493,11 @@
ampm = calendar.pm
else:
ampm = calendar.am
+
+ weekday = dt.weekday()+2
+ if weekday > 7:
+ weekday = weekday%7
+
return {
('a', 1): ampm,
('G', 1): 'AD',
@@ -506,8 +511,8 @@
('d', 2): "%.2i" %dt.day,
('E', 1): str(dt.weekday),
('E', 2): "%.2i" %dt.weekday(),
- ('E', 3): calendar.weekdays[(dt.weekday()+2)%7][1],
- ('E', 4): calendar.weekdays[(dt.weekday()+2)%7][0],
+ ('E', 3): calendar.weekdays[weekday][1],
+ ('E', 4): calendar.weekdays[weekday][0],
('D', 1): dt.strftime('%j'),
('w', 1): dt.strftime('%W'),
('w', 2): dt.strftime('%.2W'),