0

I added $filter date query to retrieve items "expire_date" greater than today.

this.props.httpClient.get(`.../items?&$filter=expire_date ge datetime ` +  Date.now() + `&$top=10`,
      SPHttpClient.configurations.v1)

I tried Date.now().toString() also see same exception in console;

../items?&$filter=StartDate%20ge%20datetime%201486023536535&$top=10 400 (Bad Request)

In ReactJs, i can get current date with Date.now(), but cant figure how to use it correct format in filter query

1 Answer 1

1

Try it as below:

this.props.httpClient.get(`.../items?&$filter=expire_date ge datetime ` +  new Date().toISOString() + `&$top=10`, SPHttpClient.configurations.v1)

It should be as :

"/_api/lists/listname/items?$filter=Created ge datetime'" + new Date().toISOString() + "'"

Your Answer

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

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