You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using DateTimeField and rendering a template, the html tag generated look like this :
The type is "datetime" which does not mean anything in vanilla HTML. So the browser display the field as a text Field.
The type should be "datetime-local"
Tested with WTforms 3.0.1
The text was updated successfully, but these errors were encountered:
JacobsThierry
changed the title
DateTimeField uses a invlalid html-5 type
DateTimeField uses a invalid html-5 type
Jul 8, 2022
classDateTimeLocalField(DateTimeField):
""" Same as :class:`~wtforms.fields.DateTimeField`, but represents an ``<input type="datetime-local">``. """widget=widgets.DateTimeLocalInput()
def__init__(self, *args, **kwargs):
kwargs.setdefault("format", ["%Y-%m-%d %H:%M:%S", "%Y-%m-%dT%H:%M:%S"])
super().__init__(*args, **kwargs)
Indeed it seems that <input type="datetime"> is now obsolete. I don't know if we should remove the field in wtforms, or if we should keep it for some compatibility reasons.
azmeuk
changed the title
DateTimeField uses a invalid html-5 type
Use HTML datetime-local input with DateTimeField
Jul 22, 2023
When using DateTimeField and rendering a template, the html tag generated look like this :
The type is "datetime" which does not mean anything in vanilla HTML. So the browser display the field as a text Field.
The type should be "datetime-local"
Tested with WTforms 3.0.1
The text was updated successfully, but these errors were encountered: