planningcenter / developers

Planning Center API docs and support
https://developer.planning.center/docs/
85 stars 8 forks source link

Datetimes in UTC are incorrect for /services/v2/service_types #1198

Closed tubaman closed 3 months ago

tubaman commented 3 months ago

Affected Product Which product does this bug affect? Services

Describe the bug

Our services start at 10 am central time(America/Chicago). However the last_time_at property returned from /services/v2/service_types is 10 am UTC. Example: 'last_time_at': '2024-06-02T10:00:00Z'.

Expected Behavior

I would instead expect it to be properly converted to UTC like this: 'last_time_at': '2024-06-02T15:00:00Z' for a 10 am service in US Central timezone.

To Reproduce

  1. Create a plan in a the US Central timezone (set your account timezone to US Central)
  2. Send a cURL request to /services/v2/service_types
  3. See that the last_time datetime hasn't been properly converted from US Central to UTC

I have..

tubaman commented 3 months ago

Maybe a dup of https://github.com/planningcenter/developers/issues/987 ?

tubaman commented 3 months ago

Recommendation: Add a note to the docs indicating which attributes are "legacy" attributes that incorrectly return local time marked as UTC. Perhaps include a deprecation notice that points users instead to the service times as mentioned.

tubaman commented 3 months ago

Some discussion around how to handle deprecation in JSON API

tannermares commented 3 months ago

Hey @tubaman! Thanks for the report. Unfortunately we've got some internal applications that rely on this field being in the Organization's local time. It's a similar story for the sort_date field. It isn't actually "deprecated" but is also needed in the Organization's local time. I'm going to add a note in our API docs that those dates are NOT UTC.