Handle Timezones in calendars and events
mainBy default, the package uses the timezone defined in the DateTime objects provided. If no timezone is provided, it defaults to UTC.
Key Concepts:
- Disabling Timezones: Use
withoutTimezone()on anEventor aCalendarto treat times as floating/local time. - Auto-Timezone Components: The package automatically adds Timezone components to the iCalendar output. Disable this with
withoutAutoTimezoneComponents()on theCalendar. - Manual Timezone Crafting: You can manually define
TimezoneandTimezoneEntryobjects to describe daylight savings transitions or specific offsets.
// Event without a timezone (floating time)
Event::create()
->startsAt(new DateTime('2019-03-06 12:00'))
->withoutTimezone();
// Calendar without automatic timezone components
Calendar::create()->withoutAutoTimezoneComponents();