7

I am build a JSON export using a View in Drupal 8. Problem is that the parameters for retrieving the json doesn't seem to work as I would want.

In my View I need use two exposed filter criteria to select a date range. Both fields are Date and Time fields. When clicking on one of the criteria I have created it says:

Value type

A date in any machine readable format. CCYY-MM-DD HH:MM:SS is preferred.

I would like this url with this parameter values to work: http://example.com/api/?start=20161101&end=20161102

I thought it was working at first, but apparently not when I get my results.

This works:

http://example.com/api/?start=2016-12-08%2000%3A00%3A00&end=2016-12-21%2024%3A00%3A00

I am trying to have those clean parameters instead. How can I change the filter format to use the YYYYMMDD format? I don't want to change my field type because it is storing the time for my events. I want to get the data through only dates.

1 Answer 1

1

You need to: - Set the filter granularity to "Day" - Add a date format "Ymd" admin/config/regional/date-time/formats - Add a date type to attach that to...admin/config/regional/date-time - OR, just change whatever date type the view is using to use it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.