EXDATE and Timezone

Help
2010-07-19
2014-03-25
  • Michael Ogrinz
    Michael Ogrinz
    2010-07-19

    I'm having problems getting Google to import a file w/ EXDATE values. It seems they want to see something like this:

    EXDATE;TZID=America/Los_Angeles:20100719T112500

    but iCal4J outputs this:

    EXDATE:20100718T162500

    I've tried setting the timezone on the datetime itself, the DateTime list, and the exdata. I've also setUTC to false. But I can't get TZID to display (it displays fine in the event's DTSTART)

    Does anyone have any ideas?

     
  • Ben Fortuna
    Ben Fortuna
    2010-07-20

    Hi Mike,

    I have created a test to demonstrate how this should work:

            final TimeZoneRegistry tr = TimeZoneRegistryFactory.getInstance().createRegistry();
            final TimeZone tz = tr.getTimeZone("America/Los_Angeles");
            
            final ExDate exDate = new ExDate();
            exDate.setTimeZone(tz);
            exDate.getDates().add(new DateTime("20100719T112500"));
    

    Output:

    EXDATE;TZID=America/Los_Angeles:20100718T182500

    Assuming you are doing something similar, it's possible that there are some unreleased code changes that allow this to work. You might like to try the latest snapshot build to see if it works differently:

    http://m2.modularity.net.au/snapshots/net/fortuna/ical4j/ical4j/1.0-SNAPSHOT/

    I will try to find time to build a new iCal4j in the coming weeks that should hopefully resolve a number of outstanding issues. Thanks also for your support, it is greatly appreciated.

    regards,
    ben

     
  • Michael Ogrinz
    Michael Ogrinz
    2010-07-22

    Thanks Ben,

    I was actually adding the dates to a DateList, and then doing this:

    exceptions.setTimeZone(timezone);
    ExDate exdate = new ExDate(exceptions);     
    exdate.setTimeZone(timezone);
    exdate.setUtc(false);
    iCalendarEvent.getProperties().add(exdate)
    

    ;

    When I followed your example (even with the current build) it worked correctly.

    Thanks for the quick response and the great library!
    Mike

     
    • Richard Liu
      Richard Liu
      2014-03-25

      Hi Mike,
      I am using the 1.0.5 version of ical4j. The problem Ben mentioned is fixed when I used:

      exDate.getDates().add(new DateTime("20140602T000000"));

      But the problem still exist when I use date as variable of the method: (considering in the source the method's variable is java.util.date)

      DateList dl = new DateList();
      dl.add(new Date(df.parse("2014-06-02 09:00")));
      dl.add(new Date(df.parse("2014-06-16 09:00")));
      dl.add(new Date(df.parse("2014-06-30 09:00")));
      ExDate exDate = new ExDate(dl);

      The output is:

      EXDATE:20140601T200000,20140615T200000,20140629T200000

      Regards,
      Richard