mangstadt / biweekly

biweekly is an iCalendar library written in Java.
BSD 2-Clause "Simplified" License
323 stars 44 forks source link

VTimezone #53

Closed LucioC closed 8 years ago

LucioC commented 8 years ago

Hello,

I think I'm having a problem with timezones in an iCalendar example I'm using.

I created a recurring event on outlook and exported to iCalendar format for testing. It uses my timezone. The resulting iCalendar data is in here http://pastebin.com/ABXCD18s

So, it contains two VTIMEZONE objects, and the VEVENT references them like: DTSTART;TZID="Unnamed Time Zone 1":20160805T150000 DTEND;TZID="E. South America Standard Time":20160805T153000

This is supposed to be America/Sao_Paolo timezone which is -3:00 GMT. So I try to verify the final value I'm getting like (using joda time):

    assertEquals(new DateTime(Instant.parse("20160805T150000", DateTimeFormat.forPattern("yyyyMMdd'T'HHmmss"))).toDateTime().plusHours(3).getMillis(), event.getDateStart().getValue().getTime());

    assertEquals(new DateTime(Instant.parse("20160805T153000", DateTimeFormat.forPattern("yyyyMMdd'T'HHmmss"))).toDateTime().plusHours(3).getMillis(), event.getDateEnd().getValue().getTime());

If I use direct GMT values the test works. What I'm I missing to make sure the time is taking into consideration the vtimezone?

LucioC commented 8 years ago

It seems my test is wrong. Instant seems to be getting my timezone. I will close this and open a new one if I don't resolve it.