jazzband / django-floppyforms

Full control of form rendering in the templates.
http://django-floppyforms.readthedocs.org/
Other
839 stars 145 forks source link

DateTimeInput widget format #125

Open bmihelac opened 10 years ago

bmihelac commented 10 years ago

DateTimeInput should use rfc3339 format (see #27, #115).

Since support for datetime input type has been removed from recent browsers, usefulness of having this widget used by default is questionable (because we are forcing rfc3339 format and almost no one have any use of this).

It would maybe make sense to add datetime-local widget (again not as default).

http://html5test.com/compare/feature/form-datetime-element.html http://html5test.com/compare/feature/form-datetime-local-element.html

gregmuellegger commented 9 years ago

I'm a little confused about what todo about this.

W3C

The current W3C recommendation does not include the datetime input type: http://www.w3.org/TR/html5/ Where as the current HTML 5.1 nightly editor draft does include it: http://www.w3.org/html/wg/drafts/html/master/ However the datetime-local is missing in both documents.

WHATWG

The WHATWG does include datetime and datetime-local in the current draft: https://html.spec.whatwg.org/multipage/ (as of 13th March 2015) But as this page states, the datetime-local was removed a while back already: http://webmasters.stackexchange.com/a/59541

The Reality (tm)

I don't see a reason why we shoud follow the one standard over the other here. I would suggest a pragmatic approach and drop support for datetime, as that is the way all major browsers are going.

What do you think?

Not-Qualified commented 5 years ago

dob = forms.DateField(widget=forms.widgets.DateTimeInput(attrs={"type": "date"}))

this will create field, also you can create <input type="time' /> by using "type" : "time" in attrs

Simply can create date and time different field in database can solve or you can merge input of both fields