The html5 fields provided by WTForms do include a DateTimeLocalField - v2.3.x, v3.0.x. Thus (v2.3)
from wtforms.fields.html5 import DateTimeLocalField
dttm = DateTimeLocalField("Date/Time: ", format="%Y-%m-%dT%H:%M")
will show the html5 date picker and time picker popups on browsers that support them (support is varied).
I find you need to specify format="%Y-%m-%dT%H:%M" - note the T - because the default format="%Y-%m-%d %H:%M" fails validation (see quote below).
input type="datetime" appears to be deprecated, so browsers fall back to plain text entry: input type="datetime" | MDN.
input type="datetime-local", and thus WTForms DateTimeLocalField, should always be used: input type="datetime-local" | MDN.
From the latter:
One thing to note is that the displayed date and time formats differ from the actual value; the displayed date and time are formatted according to the user's locale as reported by their operating system, whereas the date/time value is always formatted YYYY-MM-DDThh:mm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With