GraphQL API Usage of DateTime scalar

I’m playing around with the v4 API to retrieve contributions made between two points in time. However, I’m running into an issue know that makes we question the implementation of the filterting on the API.

I’m using the from and to  parameters on https://developer.github.com/v4/object/user#contributionscollection.

The documentation about the DateTime scalar tells me that a DateTime is An ISO-8601 encoded UTC date string. which would mean 2019-01-01 (date only) however the API tells me that this is invalid so I’m using a ISO Extended Z string like 2019-01-01T00:00:00Z  which works.

There is only one issue. It looks like the filter only looks at the date component and not at the time.

This is problematic since I’m passing in datetime values in UTC (Z) that have been converted from local timezone (GMT+1).

This means that If I wanna list all contributions at the day of 2019-01-01  it will get turned into 2018-12-31T23:00:00Z  since only the date is respected this will also return all entries that happened at the 2 018-12-31.

This feels broken to me since the API should accept a date string without the time information if only this is used.

Example:

1 Like

I can understand your frustration with the confusing design of the API. On the other hand, the contributions collection information is only aggregated by the calendar day, so ignoring the time makes sense.

Let us know if you have more questions.

My bigger issue here is that the documentation is wrong - it doesn’t allow an ISO 8601 *date*, it requires a date time.