-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
It would be good to have a validator for JSON date timestamps (as resulting from (new Date()).toJSON()
or JSON.stringify(new Date())
, e.g. 2014-09-13T12:08:06.080Z
)
It can be useful to validate arrays or objects resulting from the deserialization of a JSON string where some field represents a Date object.
A common use case is when you have to write a JSON rest API and you have to handle date fields coming from the request (and it's obviously good to validate these fields before using them on the server side).
I have written my own implementation for this and if it seems a good feature to integrate in the symfony core a can submit a pull request and write the related documentation.
PS: the validator can also be extended even further and support the entire ISO8601specification (eg. ISO8601DateValidator
)