[Django] #33165: DateInput default date is not shown when localization is on

2 views
Skip to first unread message

Django

unread,
Oct 3, 2021, 11:31:00 AM10/3/21
to django-...@googlegroups.com
#33165: DateInput default date is not shown when localization is on
-----------------------------------------+------------------------
Reporter: m-zat | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
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

--
Ticket URL: <https://code.djangoproject.com/ticket/33165>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 3, 2021, 6:45:32 PM10/3/21
to django-...@googlegroups.com
#33165: DateInput default date is not shown when localization is on
-------------------------------+--------------------------------------
Reporter: Marco Zatta | Owner: nobody

Type: Uncategorized | Status: new
Component: Forms | Version: 3.2
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Tim Graham):

This sounds like a browser issue and not Django's fault?

--
Ticket URL: <https://code.djangoproject.com/ticket/33165#comment:1>

Django

unread,
Oct 4, 2021, 3:26:52 AM10/4/21
to django-...@googlegroups.com
#33165: DateInput default date is not shown when localization is on
-----------------------------+--------------------------------------
Reporter: Marco Zatta | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 3.2
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* type: Uncategorized => Bug
* resolution: => needsinfo


Comment:

Thanks for the report, however I cannot reproduce this issue. Can you
provide a minimal project to reproduce?

--
Ticket URL: <https://code.djangoproject.com/ticket/33165#comment:2>

Django

unread,
Oct 4, 2021, 3:49:43 AM10/4/21
to django-...@googlegroups.com
#33165: DateInput default date is not shown when localization is on
-----------------------------+--------------------------------------
Reporter: Marco Zatta | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 3.2
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------

Comment (by Claude Paroz):

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/33165#comment:3>

Reply all
Reply to author
Forward
0 new messages