Search code examples
calendargmailgoogle-calendar-apiicalendar

How to update Gmail disaplayed timezone with ics attachment


I created an application to manage appointments in Lithuania. I managed to attach .ics file to an email where clients could see their upcomming appointments. I noticed that some non-it or just temporarily visiting the country users have other timezones set on their devices which most of the times confuses them. Is it possible to make the displayed timezone fixed to Europe/Vilnius?

enter image description here

Here's the .ics attachment from the same email:

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:grozissaviems
X-WR-TIMEZONE:Europe/Vilnius
METHOD:PUBLISH
BEGIN:VTIMEZONE
TZID:Europe/Vilnius
X-LIC-LOCATION:Europe/Vilnius
END:VTIMEZONE
BEGIN:VEVENT
UID:[email protected]
SEQUENCE:0
SUMMARY:Testavimo paslauga
DTSTAMP:20240514T124512Z
DTSTART:20240515T130000Z
DTEND:20240515T140000Z
DESCRIPTION:Daugiau informacijos http://local.grozissaviems.lt/premium/vizitai
LOCATION:Vilniaus g. 38\, Telšiai\, Telšių rajono savivaldybė\, Lietuva
STATUS:CONFIRMED
BEGIN:VALARM
TRIGGER:-PT30M
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR

The DTSTART and DTEND are UTC dates in Ymd\THis\Z format.

I also tried the below and it doesn't work:

DTSTART;TZID=Europe/Vilnius:20240515T130000

Solution

  • BEGIN:VCALENDAR
    VERSION:2.0
    CALSCALE:GREGORIAN
    PRODID:grozissaviems
    X-WR-TIMEZONE:Europe/Vilnius
    METHOD:PUBLISH
    
    BEGIN:VTIMEZONE
    TZID:Europe/Vilnius
    X-LIC-LOCATION:Europe/Vilnius
    
    # Added standard time definition to clarify the timezone details. 
    
    BEGIN:STANDARD
    DTSTART:20240515T130000
    TZOFFSETFROM:+0300
    TZOFFSETTO:+0300
    TZNAME:EET
    END:STANDARD
    END:VTIMEZONE
    
    BEGIN:VEVENT
    UID:[email protected]
    SEQUENCE:0
    SUMMARY:Testavimo paslauga
    DTSTAMP:20240514T124512Z
    
    # Removed 'Z' suffix.
    # 'Z' suffix indicates UTC time, which was causing confusion 
    # as it didn't specify the Europe/Vilnius timezone.
    
    DTSTART;TZID=Europe/Vilnius:20240515T130000
    DTEND;TZID=Europe/Vilnius:20240515T140000
    DESCRIPTION:Daugiau informacijos http://local.grozissaviems.lt/premium/vizitai
    LOCATION:Vilniaus g. 38\, Telšiai\, Telšių rajono savivaldybė\, Lietuva
    STATUS:CONFIRMED
    
    BEGIN:VALARM
    TRIGGER:-PT30M
    ACTION:DISPLAY
    END:VALARM
    END:VEVENT
    END:VCALENDAR