Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
@adrianholovaty adrianholovaty authored
Showing with 3 additions and 7 deletions.
  1. +2 −6 django/utils/dateformat.py
  2. +1 −1  docs/templates.txt
View
8 django/utils/dateformat.py
@@ -13,7 +13,7 @@
from django.utils.dates import MONTHS, MONTHS_AP, WEEKDAYS
from django.utils.tzinfo import LocalTimezone
-from calendar import isleap
+from calendar import isleap, monthrange
import re, time
re_formatchars = re.compile(r'(?<!\\)([aABdDfFgGhHiIjlLmMnNOPrsStTUwWyYzZ])')
@@ -124,10 +124,6 @@ def F(self):
def I(self):
"'1' if Daylight Savings Time, '0' otherwise."
- raise NotImplementedError
-
- def I(self):
- "'1' if Daylight Savings Time, '0' otherwise."
if self.timezone.dst(self.data):
return '1'
else:
@@ -185,7 +181,7 @@ def S(self):
def t(self):
"Number of days in the given month; i.e. '28' to '31'"
- raise NotImplementedError
+ return '%02d' % monthrange(self.data.year, self.data.month)[1]
def T(self):
"Time zone of this machine; e.g. 'EST' or 'MDT'"
View
2  docs/templates.txt
@@ -552,7 +552,7 @@ Available format strings:
s Seconds, 2 digits with leading zeros. ``'00'`` to ``'59'``
S English ordinal suffix for day of the ``'st'``, ``'nd'``, ``'rd'`` or ``'th'``
month, 2 characters.
- t Not implemented.
+ t Number of days in the given month. ``28`` to ``31``
T Time zone of this machine. ``'EST'``, ``'MDT'``
U Not implemented.
w Day of the week, digits without ``'0'`` (Sunday) to ``'6'`` (Saturday)
Please sign in to comment.
Something went wrong with that request. Please try again.