I’m updating an existing React site where the client wants to add the ability to schedule posts for their Blog. I’m following the suggested way;
https://www.contentful.com/developers/docs/tutorials/general/scheduling-posts/
Since it is an existing site there are a number of entries with the startDate
as blank. Ideally, I would want these to appear and only check the date if set. If I must I can write a script to populate the field.
However, not every entry will have a set endDate
, but they are not being returned if a date is not set. How can update my query so all entries are returned if the startDate
is null OR [lte] currentTime
and the endDate
is null OR [gt] currentTime
?
query={{
'fields.startDate[exists]': false,
'fields.endDate[exists]': false,
'fields.startDate[lte]': currentTime,
'fields.endDate[gt]': currentTime,
'order': '-fields.startDate'
}}