mirror of
https://github.com/django/django.git
synced 2025-09-27 04:29:17 +00:00
Fixed #3488: Added "b" option to date format filter. Thanks, Gary Wilson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4647 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
0e683f6da4
commit
28ad156f10
3 changed files with 8 additions and 1 deletions
|
@ -16,7 +16,7 @@ from django.utils.tzinfo import LocalTimezone
|
|||
from calendar import isleap, monthrange
|
||||
import re, time
|
||||
|
||||
re_formatchars = re.compile(r'(?<!\\)([aABdDfFgGhHiIjlLmMnNOPrsStTUwWyYzZ])')
|
||||
re_formatchars = re.compile(r'(?<!\\)([aAbBdDfFgGhHiIjlLmMnNOPrsStTUwWyYzZ])')
|
||||
re_escaped = re.compile(r'\\(.)')
|
||||
|
||||
class Formatter(object):
|
||||
|
@ -110,6 +110,10 @@ class DateFormat(TimeFormat):
|
|||
if hasattr(self.data, 'hour') and not self.timezone:
|
||||
self.timezone = LocalTimezone(dt)
|
||||
|
||||
def b(self):
|
||||
"Month, textual, 3 letters, lowercase; e.g. 'jan'"
|
||||
return MONTHS_3[self.data.month]
|
||||
|
||||
def d(self):
|
||||
"Day of the month, 2 digits with leading zeros; i.e. '01' to '31'"
|
||||
return '%02d' % self.data.day
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue