-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Describe the bug
My time zone is Hawaii. The offset is -10:00
. One of my fixtures includes this date string: 2023-06-13T11:30:48-10:00
(equivalent to 2023-06-13T21:30:48.000Z
). The timestamp breaks anything using the date
or date-time
object serializer dateToRFC3339String
function. The serialized form is: 2023-06-13T31:30:48+10:00
. Note the hour 31
. The Datadog API returns a 400 Bad Request
with an error on the relevant parameter.
To Reproduce
Steps to reproduce the behavior:
- Instantiate a date with hour 11 and offset -10
- Use that date for any
date
ordate-time
serialized parameter (I usedstart_date
with V2 Estimated Cost by Org) - Observe a 400 response from the Datadog API
Expected behavior
Dates in any time zone serialize properly.
Screenshots
Not/Applicable.
Environment and Versions (please complete the following information):
- Node:
v16.19.0
datadog-api
:1.10.10
Additional context
I think the problem is here. This causes the hour wrap around when the UTC hour plus offset exceeds 24. My test date is UTC hour 21 plus the offset (10) comes out to 31.
I don't understand why date components (ymd, hour/minute/seconds, etc) are pulled in UTC, then manipulated again by the offset. It seems easier to return something without the offset at this point.
Also, the API docs state the format is ISO860
but the code does not use it.