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

DateField validation is broken #782

Open
crawlchange opened this issue Apr 14, 2023 · 1 comment
Open

DateField validation is broken #782

crawlchange opened this issue Apr 14, 2023 · 1 comment
Labels
onhold Waiting feedback

Comments

@crawlchange
Copy link

crawlchange commented Apr 14, 2023

I have a form that has a DateField value. I do this:

print(form.expires_at, file=sys.stderr)
print(type(form.expires_at.data), file=sys.stderr)
print(form.expires_at.data, file=sys.stderr)

The output is:

<input id="expires_at" name="expires_at" required type="date" value="">
<class 'datetime.date'>
2023-04-18

Then, in the next line:

form.validate_on_submit()
"Not a valid date value."

What IS a valid date value? How is a python datetime.date not a valid date value?

@azmeuk
Copy link
Member

azmeuk commented Jul 21, 2023

How is your form initialized?

Please provide a minimal reproducible example ideally something that one can just copy/paste in a python terminal and that demonstrates your issue, like:

>>> import wtforms
>>> class F(wtforms.Form):
...     foo = wtforms.DateField()
>>> f = F(...)
>>> f.validate()
...

@azmeuk azmeuk added the onhold Waiting feedback label Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
onhold Waiting feedback
Development

No branches or pull requests

2 participants