-
-
Notifications
You must be signed in to change notification settings - Fork 965
how to handle when use submit empty datetime? #780
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
Comments
@dunglas , seems no one has this troubleοΌhow do you solve this please? |
@videni I have exactly the same problem. Were you able to solve this? |
@Lobosque , I create a dedicated denormalizer which will unset the key of the date time attribute if user submit an empty date time. as the example below, currently I hard coded the key 'expires_at' for I only have one entity to deal with, if you have several attributes you can add configuration yourself.
|
@videni thank you for sharing your solution. |
This is happening to me too. Can't find a way to solve this. |
@dunglas Would you accept a PR to make API Platform accept empty datetime and denormalize them as |
Hey Guys, I have handle it that way: https://stackoverflow.com/questions/61852792/api-platform-datetimenormalizer-not-allowing-null/61852793#61852793 |
Same problem here at 2021. |
Just set for setter function with ? and param DateTime|null. It works! /** |
currently, when user submit an empty datetime, we will get error
The text was updated successfully, but these errors were encountered: