Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iCalendar daylight saving time

I give my users a link they can use to put their appointments that are on my system in their calendar software like Outlook,... using an iCalendar URL.

I generate the dates in the file using this code:

echo "DTSTART;TZID=" . date_default_timezone_get() . ":" . strftime('%Y%m%d', strtotime($app->app_start)) . 'T' . strftime('%H%M%S', strtotime($app->app_start)) . '' . $eol;
echo "DTEND;TZID=" . date_default_timezone_get() . ":" . strftime('%Y%m%d', strtotime($app->app_end)) . 'T' . strftime('%H%M%S', strtotime($app->app_end)) . '' . $eol;

This always worked correctly. But now we're in daylight saving time and all the appointments that are in daylight saving time appear 1 hour too late in my Outlook. Appointments before DST are okay.

So, for example in my ics:

DTSTART;TZID=Europe/Brussels:20150318T083000 DTEND;TZID=Europe/Brussels:20150318T090000

This shows correctly in my calendar, from 08:30 till 09:00

DTSTART;TZID=Europe/Brussels:20150407T083000 DTEND;TZID=Europe/Brussels:20150407T090000

This is my problem, this shows incorrectly in my calendar: from 09:30 till 10:30.

How can I fix this?

like image 676
user1026090 Avatar asked Feb 05 '26 19:02

user1026090


1 Answers

You need to make sure your ics file includes the time zone definition, e.g.

BEGIN:VTIMEZONE
TZID:US Mountain Standard Time
BEGIN:STANDARD
RRULE:FREQ=YEARLY;BYMONTH=0;BYDAY=+10SU
DTSTART:16010000T000000
TZOFFSETFROM:-0700
TZOFFSETTO:-0700
END:STANDARD
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:Eastern Standard Time
BEGIN:STANDARD
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=+11SU
DTSTART:16011101T020000
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
BEGIN:DAYLIGHT
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=+12SU
DTSTART:16010302T020000
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
END:VTIMEZONE
like image 97
Dmitry Streblechenko Avatar answered Feb 09 '26 07:02

Dmitry Streblechenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!