Opened 11 years ago

Closed 11 years ago

Last modified 7 years ago

#22538 closed Uncategorized (duplicate)

Support for HTML5 Date and Time input fields

Reported by: me@… Owned by: nobody
Component: Forms Version: 1.6
Severity: Normal Keywords:
Cc: W. Trevor King Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

By default, the input_type of fields of type DateInput, DateTimeInput, TimeInput in the file django/forms/widgets.py is "text". This is because these fields inherit from TextField class which has input_type = "text".

If we change the input_type in each of the classes to their HTML5 specified equivalent, forms will be better.

...
class DateInput(TextInput):
     input_type = "date"
...

...
class DateTimeInput(TextInput):
     input_type = "datetime"
...

...
class TimeInput(TextInput):
     input_type = "time"
...

Change History (3)

comment:1 by anonymous, 11 years ago

Resolution: duplicate
Status: newclosed

comment:2 by W. Trevor King, 7 years ago

For folks finding this (old) issue and wondering which issue this is a duplicate of, I'm guessing it's #16630 based on comment:2:ticket:21470 closing a similar request for native type="date", etc. There's also some related (and slightly more recent) discussion in #11385.

And since f1bdfbd2 (v1.5a), you've been able to explicitly set type via attrs, so folks who want a specific input type can make that happen.

comment:3 by W. Trevor King, 7 years ago

Cc: W. Trevor King added
Note: See TracTickets for help on using tickets.
Back to Top