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

Allow DateTime or Null #779

Closed
wolfkarl opened this issue May 24, 2017 · 1 comment
Closed

Allow DateTime or Null #779

wolfkarl opened this issue May 24, 2017 · 1 comment
Assignees

Comments

@wolfkarl
Copy link

I'm serializing JSON using the Serializer Bundle and I'd like to allow it either a specified DateTime Format or null -- ist that possible?

type: DateTime<'Y-m'>

works fine for checking if it's a valid date, but obviously throws an error on NULL. Is there any possibility to make the field "optional"?

Thanks in Advance!

@goetas goetas self-assigned this May 24, 2017
@wolfkarl
Copy link
Author

I've just revisited this and it turns out that this is actually possible already, if you pass NULL. Passing an empty string however will result in an invalid format error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants