Opened 7 years ago

Closed 6 years ago

Last modified 5 years ago

#11385 closed (wontfix)

DateTimeField doesn't accept ISO 8601 formatted date string

Reported by: jtiai Owned by: nobody
Component: Database layer (models, ORM) Version: 1.0
Severity: Keywords: datetime orm format
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


DateTimeField doesn't accept ISO 8601 formatted date string. Differene is that ISO format allows date and time separator to be capital T letter. (Format being YYYY-MM-DDTHH:MM:SS. Django expects to have only space as a date and time separator.

Change History (2)

comment:1 Changed 6 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

ISO8601 is a good machine format, but not a particularly nice human readable format. Form processing is primarily about human-readable input.

If you disagree, the DateTimeField input formats are configurable (DATETIME_INPUT_FORMATS), so you can add ISO8601 format in your own projects if you want.

comment:2 Changed 5 years ago by kmike

I think the problem can't be resolved with DATETIME_INPUT_FORMATS tweaking.

ISO8601 format allows timezone info: '2010-09-01T19:52:15+04:00'. Such strings can't be parsed with python's strptime because python's strptime doesn't support '%z' format char ( So DATETIME_INPUT_FORMATS directive is not helpful for ISO8601 handling.

The solution is probably to use custom form field.

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