Update time entry on workspace Wrong Format

I don’t know if this is something with the API doing something stupid or if I am.

I enter a number of time entries into Clockify. When I enter them, they do not have a tag. I only use one tag: when I export the information from Clockify. To export the information, I pull a detailed report into javascript (via the /reports/detailed API endpoint) with each of the time entries. I then have to re-submit those time entries to Clockify through the API (using a put call on the time-entries endpoint), but with the tag, to add a tag to a given entry.

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.

Hi @databoy2k! Do you still have this working? I am trying to use the update time entry endpoint and keep getting an error. Could you post a piece of code that worked for you previously?