solspace / craft-calendar

Calendar for Craft: The most reliable and powerful event management plugin for Craft.
http://docs.solspace.com/craft/calendar/v5
Other
15 stars 16 forks source link

Importing with ISO time with offset/time zone not being honored #247

Closed gbowne-quickbase closed 10 months ago

gbowne-quickbase commented 11 months ago

Describe the bug or issue you're experiencing We use FeedMe to import events with ISO timestamps, and some are set in other time zones, so the start time reflects the start in that time zone: StartTime: "2023-12-20T10:00:00+11:00" which is 10am, but in Sydney, Australia. This imports into the Calendar as 10:00am, although my site has UTC as the system time zone. image

When we pull it into another section of our site, Craft properly adjusts the time zone to that of the CMS itself, since UTC and Sydney are 11 hours off image

Steps to reproduce

  1. Import an event with an ISO date time with a time zone offset
  2. See that the time zone offset is ignored and the time is not converted to the Craft instance's time zone

Expected behavior Events are all imported into the instance's time zone.

Craft & Plugin Info (please complete the following information):

Additional context

laurabennett commented 11 months ago

I just noticed similar issue. We have an event feed being used by a vendor and the times are all :00+00:00 but shouldn't they be :00-05:00 since the site is configured for EST?

kjmartens commented 10 months ago

Sorry for the delay @gbowne-quickbase and @laurabennett.

Calendar is working as intended because it uses Floating Times so that dates/times are always the same. We understand that this will not be desirable for anyone who is looking to offer localized times across the country/world, but there isn't a way around it unfortunately.

How does Calendar handle timezones?

Calendar does not use Timezones. All event date data is stored as UTC+0, and retrieved as UTC+0. So, no matter where you are in the world, an event start date entered at 6pm will be stored and displayed always as 6pm. The calendar.export template query compensates for this by setting the timezone as floating, which (in the current example) means the event will show up at 6pm no matter what timezone the user is located in.

The only place timezones are used is when it checks the current date/time of the currently logged in user, or logged out user. If a user is logged in, Calendar will show/consider today as whichever day it is for that user. If the user is not logged in, Calendar will use the site's current timezone to determine when today is. For example, this is used for highlighting the correct date in a month or week view calendar as Today, or determining which month to show (in the case of last or first day of the month).

https://docs.solspace.com/craft/calendar/v4/setup/faq/#how-does-calendar-handle-timezones

kjmartens commented 10 months ago

Sorry for the delay @gbowne-quickbase and @laurabennett.

Calendar is working as intended because it uses Floating Times so that dates/times are always the same. We understand that this will not be desirable for anyone who is looking to offer localized times across the country/world, but there isn't a way around it unfortunately.

How does Calendar handle timezones?

Calendar does not use Timezones. All event date data is stored as UTC+0, and retrieved as UTC+0. So, no matter where you are in the world, an event start date entered at 6pm will be stored and displayed always as 6pm. The calendar.export template query compensates for this by setting the timezone as floating, which (in the current example) means the event will show up at 6pm no matter what timezone the user is located in.

The only place timezones are used is when it checks the current date/time of the currently logged in user, or logged out user. If a user is logged in, Calendar will show/consider today as whichever day it is for that user. If the user is not logged in, Calendar will use the site's current timezone to determine when today is. For example, this is used for highlighting the correct date in a month or week view calendar as Today, or determining which month to show (in the case of last or first day of the month).

https://docs.solspace.com/craft/calendar/v4/setup/faq/#how-does-calendar-handle-timezones