simonC
simonC

Reputation: 4327

ical event shown 2 hours late in some outlook clients

We have a system written in java which sends iCal events to clients.

One customer has a problem that all events sent from our system are represented in their outlooks 2 hours late as it is specified in the iCal(VCALENDAR) content.

The customer assures they have the timzone set correctly on their computers, so to Central European time. We have tested the same event on our email clients internal and in our clients (mainly Outlook) the events are correctly displayed.

We use iCal4J to construct the mime message. Is there any parameter that should I set additional to enhance the time accuracy of the event on different clients?

For example the following event was set for 10:00 till 12:00 but our customer has it represented in their outlook as 12:00 till 14:00, in our outlook the same event is shown correctly.

Here is an example of our event body:

From: =?UTF-8?Q?Tanja_Bla=C5=BEi=C4=8D?= <******@****.***>
To: Petra Lunder <******.******@******.***>
Message-ID: <15605406.0.1409569454863.JavaMail."****.*****"@*******>
Subject: test sestankov - testni sestanek 1
MIME-Version: 1.0
Content-Type: text/calendar; method=REQUEST; charset="utf-8"
Content-Transfer-Encoding: 8bit

BEGIN:VCALENDAR
PRODID:-//4pm - Arctur d.o.o.//iCal4j 1.0//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTAMP:20140901T110414Z
DTSTART:20140912T100000
DTEND:20140912T120000
SUMMARY:test sestankov - testni sestanek 1
TZID:Europe/Prague
ORGANIZER;CN=Tanja Blažič:mailto:********@***********
LOCATION:
DESCRIPTION:testni sestanek\n---------------------------------------\nsta
 tus dogodka: potrjen\n---------------------------------------\ntrenutno 
 stanje udeležbe na dogodku\n-------------------------------------\nPetra
  Lunder - nedoločeno\nSimon Cigoj - nedoločeno\nVesna Kobal - nedoločeno
\n
SEQUENCE:0
UID:2010250@em_4pm_a
STATUS:CONFIRMED
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Petra Lunder;PARTSTAT=NEEDS-AC
 TION:mailto:******.******@*****.**
 ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Simon Cigoj;PARTSTAT=NEEDS-ACT
ION:mailto:******.******@*****.**
 ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Vesna Kobal;PARTSTAT=NEEDS-ACT
 ION:mailto:******.******@*****.**
END:VEVENT
END:VCALENDAR

My java ical4j code :

    DateTime start = new DateTime(_startDate);
    DateTime end = new DateTime(_endDate);

    //meeting = new VEvent(start, end, StringUtilities.clearLatinLetters(_sumamry));
    meeting = new VEvent(start, end, _sumamry);

    TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
    VTimeZone tz = registry.getTimeZone(LocaleUtil.getTimeZoneID()).getVTimeZone();

    Organizer $organizer = new Organizer(URI.create("mailto:" + _organizerEmail));
    $organizer.getParameters().add(new Cn(_organizerName));
    meeting.getProperties().add($organizer);

    Location $location = new Location(_location);
    meeting.getProperties().add($location);

    Description $description = new Description(_description);
    meeting.getProperties().add($description);

    meeting.getProperties().add(new Sequence(Integer.parseInt(_sequence + "")));

    meeting.getProperties().add(new Uid(_customerEventId));


    calendar = new Calendar();
    // $calendar.getProperties().add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
    calendar.getProperties().add(new ProdId("-//4pm - Arctur d.o.o.//iCal4j 1.0//EN"));
    calendar.getProperties().add(Version.VERSION_2_0);
    calendar.getProperties().add(CalScale.GREGORIAN);
    calendar.getProperties().add(_method.toIcal4j());
    calendar.getComponents().add(meeting);
    calendar.getComponents().add(tz);

Upvotes: 0

Views: 530

Answers (2)

bbsimonbb
bbsimonbb

Reputation: 29002

Extending Oberron's answer, to put zoned times in Icalendar, you need a top level VTIMEZONE element that defines the timezone and a TZID attribute in the time, eg. DTSTART;TZID=Europe/Prague:20140912T100000. TZID should not be sitting out on it's own, unrelated to a time, to my eyes.

Ical4j should do this for you. See this page. Try loading the timezone registry as shown...

TimeZoneRegistry registry = builder.getRegistry();

Upvotes: 1

Auberon Vacher
Auberon Vacher

Reputation: 4775

The most likely reason for this issue is that the property TZID is set to Europe/Prague, but you did include in your calendar a component VTIMEZONE ( see RFC5545 3.6.5), the reason it works on some systems is that Outlook and other have added support for Olson timezone, but this is not stricto sensu part of the RFC standard.

Upvotes: 0

Related Questions