Concatenate (not append) DATETIME_INPUT_FORMATS (#148)

This commit is contained in:
Christopher C. Wells 2020-07-22 21:13:31 -07:00
parent 1eb02f436b
commit d138558158
1 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@ from django.conf.locale.en import formats
# Override the regular locale settings to support 24 hour time. # Override the regular locale settings to support 24 hour time.
if settings.USE_24_HOUR_TIME_FORMAT: if settings.USE_24_HOUR_TIME_FORMAT:
DATETIME_FORMAT = 'N j, Y, H:i:s' DATETIME_FORMAT = 'N j, Y, H:i:s'
DATETIME_INPUT_FORMATS = [ CUSTOM_INPUT_FORMATS = [
'%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59' '%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59'
'%m/%d/%Y %H:%M', # '10/25/2006 14:30' '%m/%d/%Y %H:%M', # '10/25/2006 14:30'
] ]
@ -13,10 +13,10 @@ if settings.USE_24_HOUR_TIME_FORMAT:
else: else:
# These formats are added to support the locale style of Baby Buddy's # These formats are added to support the locale style of Baby Buddy's
# frontend library, which uses momentjs. # frontend library, which uses momentjs.
DATETIME_INPUT_FORMATS = [ CUSTOM_INPUT_FORMATS = [
'%m/%d/%Y %I:%M:%S %p', # '10/25/2006 2:30:59 PM' '%m/%d/%Y %I:%M:%S %p', # '10/25/2006 2:30:59 PM'
'%m/%d/%Y %I:%M %p', # '10/25/2006 2:30 PM' '%m/%d/%Y %I:%M %p', # '10/25/2006 2:30 PM'
] ]
# Append all other input formats from the base locale. # Append all other input formats from the base locale.
DATETIME_INPUT_FORMATS.append(formats.DATETIME_INPUT_FORMATS) DATETIME_INPUT_FORMATS = CUSTOM_INPUT_FORMATS + formats.DATETIME_INPUT_FORMATS