I am trying to use the MIN and NOW functions that are shown in the Search API syntax as part of my custom search webscript. However, I can't seem to get it working. How do I specify default lower and upperbounds for date ranges in search?My webscript snippet is shown belowif (((createdFrom == "") || (createdFrom == null)) && ((createdTo != "") && (createdTo != null)))
{
query = '+@cm\\:created:\[' + MIN + ' TO ' + fnToISO(createdTo) + '] ' + query;
}
if ((createdFrom != "") && (createdFrom != null) && ((createdTo == "") || (createdTo == null)))
{
query = '+@cm\\:created:\[' + fnToISO(createdFrom) + ' TO ' + NOW + '] ' + query;
}
I tried to replace MIN with fnToISO('1/1/1900'), that works. However, replacing NOW with fnToISO(), results in an error. The function fnToISO is shown below.function fnToISO(dt) {
var nDate = new Date(dt);
return nDate.format("isoDateTime");
}