lStoilov
lStoilov

Reputation: 1339

.ics TZID and offset not working

I am building a simple .ics file and everything looks fine. However, no matter what I do with the .ics, when I open it on my phone it shows a wrong start and end time (+3 hours).

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
X-WR-TIMEZONE:Europe/Sofia
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Europe/Sofia
TZOFFSETFROM:+0000
TZOFFSETTO:-0300
TZNAME:CET
END:VTIMEZONE
BEGIN:VEVENT
LOCATION:Some location
DESCRIPTION:Testing Description
DTSTART:20180825T120000Z
DTEND:20180825T141000Z
SUMMARY:This is a short summary
URL;VALUE=URI:www.someurl
DTSTAMP:20180825T155441Z
UID:5b8151913501c
END:VEVENT
END:VCALENDAR

So, instead of showing start time 12 o'clock (20180825T120000Z) it shows 15:00 The strange thing is that it actually no matter what TZID I use... nothing change. Offset doesn't work either.

Any idea what can be the problem ?

Upvotes: 1

Views: 4539

Answers (1)

anmari
anmari

Reputation: 4173

it is doing exactly the right thing. Please refer to the RFC5545 Specification. https://www.rfc-editor.org/rfc/rfc5545#section-3.6.5. The VTIMEZONE simply provides a definition of the timezone, ie the base offset and any daylight saving changes etc. I suspect many apps may use their own definitions AND/OR the definitions if correct, should be the same.

So then we look at how you chosen to represent your dates ie: Form #2 as per https://www.rfc-editor.org/rfc/rfc5545#section-3.3.5, the date with UTC time. Calendar apps will then adjust the UTC time in the DTSTART according to the timezone your app is set for. It would appear that your app is set for a timezone that is 3 hours offset from UTC.

If you really do want the date to be 12pm from your timezone, the choices you have are:

  • Form #1: floating or local date-times 20180825T120000 (NO Z). It will be shown as 12 in every timezone (no adjustment) Useful for things like reminders at same time of day in local place.
  • Form #2: UTC time 20180825T090000Z (the producing code should adjust local time from UTC+3 to base UTC time)
  • Form #3: DATE WITH LOCAL TIME AND TIME ZONE REFERENCE. IE TZID:Europe/Sofia:20180825T120000. Calendar apps will convert that to the timezone of the receiving calendar app & device, taking into account any daylight saving.

Upvotes: 3

Related Questions