cronofy / cronofy-node

Node wrapper for the Cronofy API
https://docs.cronofy.com/developers
MIT License
49 stars 23 forks source link

query_periods does not accept JS Date.toISOString format #89

Closed gl-aagostino closed 1 year ago

gl-aagostino commented 2 years ago

I find it curious that when running the availability queries (https://docs.cronofy.com/developers/api/scheduling/availability/) that the query_period params do not accept a standard JS ISO format, ie (new Date()).toISOString() as it is supposedly compliant with the ISO 8601. In my testing the following works

Using dayjs library, dayjs().format() 2022-02-10T16:20:35-05:00 2022-02-10T18:59:59-05:00

Using dayjs library, dayjs().utc().format() 2022-02-10T21:20:35Z 2022-02-10T23:59:59Z

But not (new Date()).toISOString()) 2022-02-10T21:20:35.000Z 2022-02-10T23:59:59.999Z

So who is not following the standard? Cronofy or Javascript?

gshutler commented 2 years ago

2022-02-10T21:20:35.000Z should be accepted, but anything with a sub-second precision will not. This is because the underlying calendar providers do not support such accuracy.