Changes between Initial Version and Version 1 of Ticket #31595
- Timestamp:
- May 16, 2020, 3:07:30 AM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31595 – Description
initial v1 1 So, I have a DateField in my model and have also set I18N & L10Nto `True` in settings. When a browser running `en-AU` locale visits the website, Django tries to parse the value read from model, using the first value in `DATE_INPUT_FORMATS` from /conf.1 So, I have a DateField in my model and have also set **I18N & L10N** to `True` in settings. When a browser running `en-AU` locale visits the website, Django tries to parse the value read from model, using the first value in `DATE_INPUT_FORMATS` from /conf. 2 2 3 3 The bug is when a user in `en-AU` locale visits the website, Django reads the Datefield value from model and tries to localize it for `en-AU` locale (from `DATE_INPUT_FORMATS` in /conf/en_AU) to this format `'%d/%m/%Y'`, but html5 requires the `value` for `<input type="date">` to be explicitly in this format: yyyy-MM-dd. [ref](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date) [ref2](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#Format_of_a_valid_date_string).