How does Cronofy handle Daylight Saving Time?
Cronofy specifies all event times in UTC (Coordinated Universal Time). The UTC time defines when the event starts.
Events can also specify the timezone that they should be displayed in when shown to users. When you provide the Cronofy API with a timezone for an event, we send this information to the calendar provider, and the calendar provider will handle how best to display the event. The specified timezone does not change when the event is occurring.
This allows calendar viewers, such as Google Calendar or Microsoft Outlook, to show that events have a specified timezone, which can be useful to convey the local time of the host or the location of the event.
How does Cronofy handle event times? #
All events are defined using UTC to remove ambiguity about when the event is happening.
A common issue that some integrators have is that they want to describe an event for a location that uses Daylight Saving Time (DST). Regions using DST will change their offset from UTC twice per year. For example, the United Kingdom spends winter with an offset of 0 hours from UTC, but Summer is on British Summer Time with an offset of +1 hour.
All Cronofy APIs define times in UTC and do not automatically change due to daylight saving - an event occurring at 07:00 UTC
will always occur at 07:00 UTC
and a calendar provider will decide what time to show to a user based on the timezone information available.
If the end user is in a time zone three hours ahead of UTC (UTC+3), then the event is still occurring at 07:00 UTC
, and the calendar provider will render this time to account for the end user’s timezone of UTC+3. The event will show in their calendar as starting at 10:00 UTC+3
, which is the localized time for 07:00 UTC
.
If the user travels to a timezone four hours ahead of UTC (UTC+4), or their location enters daylight savings time and changes to UTC+4, the event is still occurring at 07:00 UTC
, but now the calendar provider renders it for the end user so that, in their timezone, the event occurs at 11:00 UTC+4
.
Cronofy is not moving or editing the event, the event always takes place at 07:00 UTC
but the way the calendar software renders this to the user is changing; 07:00 UTC
is the same as 10:00 UTC+3
, and also the same as 11:00 UTC+4
.
Accounting for Daylight Savings Time #
If you want a series of events to occur at the same local time regardless of Daylight Savings Time, you must adjust the time requested when creating the event.
For example, imagine we are booking a meeting at 9 AM local time in a timezone which is UTC+2 until April 1st, where it becomes UTC+3 for daylight saving time.
- The event on March 31st would need to be created at
07:00 UTC
(09:00 in UTC+2). - The event on April 1st would need to be created at
06:00 UTC
(09:00 in UTC+3).
The UTC start time has to be reduced by one hour to counteract the timezone advancing clocks by one hour.