I don’t know if this is something with the API doing something stupid or if I am.
When I pull the detailed report from the API, the end time entry is returned as this: 2021-06-10T16:04:41-06:00. When I go to “put” the time entry back using the API, that format doesn’t work. I get the error "You entered invalid value for field : [end]. Values that represent [end] can be null and can’t be empty .Please make sure that the [end] date is not greater than 9999-12-31 and not less than 0001-01-01. Ensure that the [end] date is in following format: “yyyy-MM-ddThh:mm:ssZ” Example: 2018-11-29T13:00:46Z. " This is of course error 501.
Why doesn’t Clockify report time in the same form that it accepts? Any tips for a workaround to just add a tag to a given time entry using the API without having to return all of the details of the original time entry (e.g. start time, end time, description, projectID)?
Edit: I’ve confirmed it. The detailed report API returns the time with the relevant offset but the time-entries API expects the time in UTC. That adds an unnecessary step - keep your date format consistent, please. My script now uses new Date(entry.timeInterval.end).toISOString() to convert the detailed report output to the expected format for the time-entry endpoint. This seems unnecessary.
Still, better yet, it would be really nice to use the time-entries endpoint to put a given time entry by ID and add only one detail (e.g. the tag) without having to re-enter all of the details.