Question

I have a kerywordquery in JS that is working but when i add {today-30} it does not.

This is working:

(RefinableStartDate<=Today AND RefinableEndDate>Today)

It does not when I add -30 days:

(RefinableStartDate<=Today AND RefinableEndDate>Today AND
RefinableStartDate>{Today-30})

Note: The 2nd line does actually work inside of a SP results source.

Was it helpful?

Solution

because this is in JS i passed in the date -30 days in the correct format.

var date = new Date();
date.setDate(date.getDate() - 30);
var dateString = date.toISOString().split('T')[0];

query = " (RefinableStartDate<=Today AND RefinableEndDate>Today AND RefinableStartDate>\"" + dateString + "\")";
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top