- Issue created by @andreasderijcke
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 2:51am 3 January 2024 - last update
over 1 year ago 11 pass - 🇧🇪Belgium andreasderijcke Antwerpen / Gent
Patch attached corresponding with the current state in the issue fork.
This adds JSON:API enhancers for both the Time and Time Range field, reusing the existing formatting logic to format the output.To prevent increase of, and reduce already existing code redundancy, I've added a trait to contain the actual formatting logic and the format settings field description. Perhaps more shared stuff like setting default values can be moved here in time.
Because of this trait, I'm not sure if this needs additional tests, at least not for the enhancers in the current version.
I've not added the reverse processing, as it is not required for my case, my spare time is also limited and it opens a new box of questions of what input to support. If supporting this is desired at all. If not, then current version might be good to go.
Just to give an idea what it looks like right now,
1. Regular field formatting vs the enhancers:
2. The enhancer settings:
- last update
about 1 year ago 11 pass - last update
about 1 year ago 11 pass - 🇧🇪Belgium andreasderijcke Antwerpen / Gent
Added option to include the raw value as well, as my case needs it and it seems useful for client applications anyway.
The updated enhancer settings for timerang (similar for time):This return format of the enhancers is changed from string to keyed array though, having keys 'formatted' and 'raw'.
If inclusion of the raw values is disable, the value of 'raw' is NULL.
Patch time_field-3411980-3.patch corresponds with these changes and the current MR.
- last update
about 1 year ago 11 pass - 🇧🇪Belgium andreasderijcke Antwerpen / Gent
Patch time_field-3411980-3.patch had missing empty line at the end, causing composer to fail to apply the patch.
Use time_field-3411980-4.patch