Opened 5 years ago

Closed 3 years ago

#14294 closed Bug (fixed)

default input_format not honoroed

Reported by: danols@… Owned by: nobody
Component: Documentation Version: 1.2
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

form.DateField() only accepts following formats:

'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'

But fails to accept:

'%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
'%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
'%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
'%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'

Documentations states all above should be accepted: http://docs.djangoproject.com/en/dev/ref/forms/fields/#datefield

Thanks

Change History (6)

comment:1 Changed 5 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Hmm, indeed. Those other formats were specifically disabled in r13039, which added some doc about how those formats can't be used for localized dates, but we seem to have overlooked the fact they they were included in the defaults pre-localization-support. The settings doc also has it wrong right now.

comment:2 Changed 5 years ago by ramiro

  • Component changed from Uncategorized to Documentation

comment:3 Changed 4 years ago by ramiro

#15135 was a duplicate.

comment:4 Changed 4 years ago by julien

  • Severity set to Normal
  • Type set to Bug

comment:5 Changed 4 years ago by kmtracey

  • Easy pickings unset
  • UI/UX unset

https://code.djangoproject.com/ticket/15135#comment:1, I believe, is a more accurate description than what I said above of the current situation. What both the datefield doc and the settings doc fail to mention is that what they are showing is the default for the USE_L10N=False case. Datefield doc perhaps should be nothing that the defaults (for the USE_L10N=False case) are the DATE_INPUT_FORMATS setting. In the USE_L10N=True case it's not feasible to try to state the defaults, because it varies by locale.

Also, #17532 reported this again.

comment:6 Changed 3 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from new to closed

[17554] clarified the documentation, which is the fix for this.

Note: See TracTickets for help on using tickets.
Back to Top