I may be asking the wrong question here. In SharePoint I normally filter the list with Start Date <= Today and End Date >= Today to get a list of staff that is out today. Both dates are in Date/Time format. I'm trying to accomplish the same in REST.
EDIT 12/12/2017 I think the problem lies within the formatting. SharePoint adds +8 to my current time zone so when filtered for midnight, it returns the wrong items. Any workaround this?
Below is filtered for 12/12/2017 12:00 AM
Currently using the following to filter today:
var dataUrl = siteUrl + "/_api/web/lists/getbytitle('AbsenceRequest')/items?$filter=((EventDate le '" + new Date().toISOString() + "') and (EndDate ge '" + new Date().toISOString() + "') and Status eq 'Approved')&$select=SDID, calDisplayFN, EventDate, EndDate, RequestType, Status, ActivityType";
How do I ignore the time? EventDate and EndDate are both Date/Time format or filter by midnight?
I tried but returned an error (bad request):
var today = new Date();
today = moment(today).format("MM/DD/YYYY");
var currentDate = today+'T00:00:00.000Z';
var dataUrl = siteUrl + "/_api/web/lists/getbytitle('AbsenceRequest')/items?$filter=((EventDate le datetime '" + currentDate + "') and (EndDate ge datetime '" + currentDate + "') and Status eq 'Approved')&$select=SDID, calDisplayFN, EventDate, EndDate, RequestType, Status, ActivityType";