Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #742 -- Implemented 't' dateformat. Thanks, radek.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1116 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 371f63c210ffd015cdaddba2dc5463f78051be4e 1 parent d4df074
Adrian Holovaty authored November 06, 2005
8  django/utils/dateformat.py
@@ -13,7 +13,7 @@
13 13
 
14 14
 from django.utils.dates import MONTHS, MONTHS_AP, WEEKDAYS
15 15
 from django.utils.tzinfo import LocalTimezone
16  
-from calendar import isleap
  16
+from calendar import isleap, monthrange
17 17
 import re, time
18 18
 
19 19
 re_formatchars = re.compile(r'(?<!\\)([aABdDfFgGhHiIjlLmMnNOPrsStTUwWyYzZ])')
@@ -124,10 +124,6 @@ def F(self):
124 124
 
125 125
     def I(self):
126 126
         "'1' if Daylight Savings Time, '0' otherwise."
127  
-        raise NotImplementedError
128  
-
129  
-    def I(self):
130  
-        "'1' if Daylight Savings Time, '0' otherwise."
131 127
         if self.timezone.dst(self.data):
132 128
             return '1'
133 129
         else:
@@ -185,7 +181,7 @@ def S(self):
185 181
 
186 182
     def t(self):
187 183
         "Number of days in the given month; i.e. '28' to '31'"
188  
-        raise NotImplementedError
  184
+        return '%02d' % monthrange(self.data.year, self.data.month)[1]
189 185
 
190 186
     def T(self):
191 187
         "Time zone of this machine; e.g. 'EST' or 'MDT'"
2  docs/templates.txt
@@ -552,7 +552,7 @@ Available format strings:
552 552
     s                 Seconds, 2 digits with leading zeros.     ``'00'`` to ``'59'``
553 553
     S                 English ordinal suffix for day of the     ``'st'``, ``'nd'``, ``'rd'`` or ``'th'``
554 554
                       month, 2 characters.
555  
-    t                 Not implemented.
  555
+    t                 Number of days in the given month.        ``28`` to ``31``
556 556
     T                 Time zone of this machine.                ``'EST'``, ``'MDT'``
557 557
     U                 Not implemented.
558 558
     w                 Day of the week, digits without           ``'0'`` (Sunday) to ``'6'`` (Saturday)

0 notes on commit 371f63c

Please sign in to comment.
Something went wrong with that request. Please try again.