I see default_format
and default_timezone
configs for deserializing datetime values but I don't see a config to specify a list of alternate formats. I would like for my API to accept timestamps with our without timezone (assuming UTC if not specified) and with or without fractional seconds (microseconds). The annotation example below accomplishes this but I'd rather not have to copy/paste that into the myriad of input types I use.
/**
* @JMS\Type("DateTime<'Y-m-d\TH:i:s.uP', '+00:00', ['Y-m-d\TH:i:sP', 'Y-m-d\TH:i:s.uP', 'Y-m-d\TH:i:s', 'Y-m-d\TH:i:s.u']>"
*/
protected \DateTimeInterface $timestamp;
Does anyone have an example override to accomplish this? Maybe a feature request to add support for a new default_deserialize_format
config?
Typical... Finally break down, post a question, figure it out an hour later. A Handler with priorities set high so they override the build-in handlers was what I was looking for.