Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimeLocalField should support T separator #720

Closed
azmeuk opened this issue Dec 22, 2021 · 0 comments · Fixed by #721
Closed

DateTimeLocalField should support T separator #720

azmeuk opened this issue Dec 22, 2021 · 0 comments · Fixed by #721
Labels
bug Unexpected behavior

Comments

@azmeuk
Copy link
Member

azmeuk commented Dec 22, 2021

The MDN documentation we can read that:

When you set the value of a datetime-local input, the string is normalized into a standard form. Normalized datetime strings always use the letter "T" to separate the date and the time, and the time portion of the string is as short as possible. This is done by leaving out the seconds component if its value is :00.

However, wtforms currently does not support that T separator:

>>> import wtforms
>>> from tests.common import DummyPostData
>>> class F(wtforms.Form):
...     dtl = wtforms.DateTimeLocalField()
>>> F(DummyPostData({"dtl": "2020-10-10 10:10:10"})).dtl.data
datetime.datetime(2020, 10, 10, 10, 10, 10)
>>> F(DummyPostData({"dtl": "2020-10-10T10:10:10"})).dtl.data
>>>

I suggest we support that T separator out of the box. It also seems this is the separator by default in Firefox.

Might be related with #435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected behavior
Development

Successfully merging a pull request may close this issue.

1 participant