The Date Time enhancer (\Drupal\jsonapi_extras\Plugin\jsonapi\FieldEnhancer\DateTimeFromStringEnhancer) only supports one date value.
I know that there is a rework of enhancers on the 8.x-2.x branch. Looking at it, this can be ported there as well with minimal effort.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | jsonapi_extras-date-range-fields-support-2953227-d8-11.patch | 2.52 KB | ndobromirov |
| #2 | datetime-range-support.2953227.2.patch | 1.4 KB | vtcore |
Comments
Comment #2
vtcore commentedPatch suggestion.
Comment #3
e0ipsoComment #4
e0ipsoThanks for the patch. Kicking off tests.
Comment #5
vtcore commentedTests seem to pass. Can you commit to the 1.x branch?
Comment #7
e0ipsoFixed for 1.x (unsupported), now opening for 2.x.
Comment #9
e0ipso:-( I had to revert this commit because this is breaking the JSON Schema for these fields, while trying to port it to 2.x.
Take a look at
getJsonSchemainDateTimeEnhancerBase.Comment #10
ndobromirov commentedHi here is an attempt to have the schema correct with the string / array of strings variation.
Comment #11
ndobromirov commentedHere is another iteration of the patch that now I was able to test and schema validation passes on date range fields.
Comment #13
e0ipsoThanks for this contribution! Sorry it took so long to get it merged.
Comment #15
andsigno82 commentedHi, have to reopen this. using the 3.x-dev version.
the enhancer still return this error when you select either datetime or timestamp
AH01071: Got error 'PHP message: TypeError: DateTime::__construct() expects parameter 1 to be string, array given in /contenta/web/core/lib/Drupal/Component/Datetime/DateTimePlus.php