Skip to content

Commit 31fbb09

Browse files
committed
updated mapping of datetime format
1 parent a5705e3 commit 31fbb09

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

bootstrap3_datetime/widgets.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,19 @@ def __iter__(self):
3030

3131
# http://momentjs.com/docs/#/parsing/string-format/
3232
# http://docs.python.org/2/library/datetime.html#strftime-strptime-behavior
33-
format_map = (('DD', r'%d'),
34-
#('dd', r'%d'),
33+
format_map = (('DDD', r'%j'),
34+
('DD', r'%d'),
35+
('MMMM', r'%B'),
36+
('MMM', r'%b'),
3537
('MM', r'%m'),
3638
('YYYY', r'%Y'),
37-
#('yyyy', r'%Y'),
38-
('yy', r'%y'),
39-
('SSS', r'%f'),
40-
('hh', r'%H'),
39+
('YY', r'%y'),
40+
('HH', r'%H'),
41+
('hh', r'%I'),
4142
('mm', r'%M'),
4243
('ss', r'%S'),
43-
('HH', r'%I'),
44-
('PP', r'%p'),
44+
('a', r'%p'),
45+
('ZZ', r'%z'),
4546
)
4647

4748
@classmethod
@@ -74,8 +75,8 @@ def __init__(self, attrs=None, format=None, options=None, div_attrs=None, icon_a
7475
else:
7576
self.options = options and options.copy() or {}
7677
self.options['language'] = translation.get_language()
77-
if format and not self.options.get('format'):
78-
self.attrs['date-format'] = self.conv_datetime_format_py2js(format)
78+
if format and not self.options.get('format') and not self.attrs.get('date-format'):
79+
self.options['format'] = self.conv_datetime_format_py2js(format)
7980

8081
def render(self, name, value, attrs=None):
8182
if value is None:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'static/bootstrap3_datetime/js/*.js',
99
'static/bootstrap3_datetime/js/locales/*.js',]},
1010
include_package_data=True,
11-
version='1.0.3',
11+
version='2.0.0',
1212
description='Bootstrap3 compatible datetimepicker for Django projects.',
1313
long_description=open('README.rst').read(),
1414
author='Nakahara Kunihiko',

0 commit comments

Comments
 (0)