Closed
Description
Description
I was recently in the need to have to customize the way dates are being deserialized when the API I was working on would receive JSON data. The requirement was to only deserialize certain formats (3 formats to be exact). As a bonus, we should directly deserialize those into Chronos instances (although plain DateTimeImmutable would also work).
To that end, we created a custom normalizer that would attempt to deserialize those 3 formats into a Chronos instance.
However, since DateTimeNormalizer would pick up said object on account that Chronos implements DateTimeInterface/DateTimeImmutable we ended up having to deregister the DateTimeNormalizer altogether.
Solutions based on framework that would have been helpful:
- DateTimeNormalizer would be able to handle more than a single format
- DateTimeNormalizer would allow its default classes to be configured so that we could eliminate those that we wanted to handle separately.
Example
No response