DateTimeOffset not implemented for ReportExtractionOperations.GetCompletedByDateRange()

dwinson
dwinson Newcomer

I am writing C# code using the REST API SDK to download extractions that have completed in the last hour.

The code I was using was:

var completedExtractions = extractionsContext.ReportExtractionOperations.GetCompletedByDateRange(
startDate: DateTimeOffset.Now.AddMinutes(lookBackMinutes * -1),
endDate: DateTimeOffset.Now);

This code does not work for my time-zone (currently UTC+1:00). In order to get it to work I had to change DateTimeOffset.Now to DateTimeOffset.UtcNow. It appears that the time-zone info in the DateTimeOffset values is being ignored.

Is this my mistake or is the API incorrectly handling DateTimeOffset values?

Best Answer

  • Hi @dwinson,

    I have found the same result. According to description of startDate and endDate in the REST API metadata, I understand the GetCompletedByDateRange endpoint supports only UTC date and time, so the function only works with the DateTimeOffset.UtcNow.

    image