#33165 closed Bug (needsinfo)
DateInput default date is not shown when localization is on
| Reported by: | Marco Zatta | Owned by: | nobody |
|---|---|---|---|
| Component: | Forms | Version: | 3.2 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Step to reproduce:
- Create a Model with a date field
- Create a ModelForm based on said model with a widget entry to make the date a DateInput (otherwise it is shown as text field)
- With localization turned on set LANGUAGE='it-ch'
- Open a webpage showing the form with {{ form }} in the template
With 'it-ch' the default value is not shown because the value passed to the field is not understood by the browser (in this case '%d/%m/%Y'), while it is shown when using 'en-us' (in this case '%Y-%m-%d is passed)
Expected behavior:
The default date is shown independently of the locale selected server side
Change History (3)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
| Resolution: | → needsinfo |
|---|---|
| Status: | new → closed |
| Type: | Uncategorized → Bug |
Thanks for the report, however I cannot reproduce this issue. Can you provide a minimal project to reproduce?
comment:3 by , 4 years ago
This is closely related to #33113. Typically, when you are using a date input widget, the initial input value should be normalized to the YYYY-MM-DD iso format (see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date). The discussion could continue on #33113.
This sounds like a browser issue and not Django's fault?