Change ISO 8601 date format to exclude year/month (#5936)

This commit is contained in:
Ryan P Kilby 2018-04-14 00:23:31 -04:00 committed by Tom Christie
parent 1c53fd3212
commit 7078afa42c
2 changed files with 5 additions and 3 deletions

View File

@ -13,7 +13,7 @@ def datetime_formats(formats):
def date_formats(formats):
format = ', '.join(formats).replace(ISO_8601, 'YYYY[-MM[-DD]]')
format = ', '.join(formats).replace(ISO_8601, 'YYYY-MM-DD')
return humanize_strptime(format)

View File

@ -1122,8 +1122,10 @@ class TestDateField(FieldValues):
datetime.date(2001, 1, 1): datetime.date(2001, 1, 1),
}
invalid_inputs = {
'abc': ['Date has wrong format. Use one of these formats instead: YYYY[-MM[-DD]].'],
'2001-99-99': ['Date has wrong format. Use one of these formats instead: YYYY[-MM[-DD]].'],
'abc': ['Date has wrong format. Use one of these formats instead: YYYY-MM-DD.'],
'2001-99-99': ['Date has wrong format. Use one of these formats instead: YYYY-MM-DD.'],
'2001-01': ['Date has wrong format. Use one of these formats instead: YYYY-MM-DD.'],
'2001': ['Date has wrong format. Use one of these formats instead: YYYY-MM-DD.'],
datetime.datetime(2001, 1, 1, 12, 00): ['Expected a date but got a datetime.'],
}
outputs = {