Bad date for vCard and relaxed parsing

Help
2012-11-02
2013-06-05
  • Pascal Robert
    Pascal Robert
    2012-11-02

    Hi Ben,

    I'm fetching vCards by CardDAV and all birthdays (BDAY) were coming out wrong. The date in the vCard is:

    BDAY:1975-07-17

    but it was parsed (in the builder) as:

    BDAY:19741207T000000

    After hours of debugging, I found why: I had relaxed parsing on:

        CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, true);

    After I removed that, bingo the birthday date comes out correctly.

     
  • Ben Fortuna
    Ben Fortuna
    2012-11-05

    Hi Pascal,

    I have fixed this by setting the relaxed date format to be non-lenient in the ical4j DateTime class. This is included in the latest release (1.0.4). I will also release a new version of ical4j-vcard shortly, but in the meantime you should be able to just drop in the ical4j-1.0.4 jar and it will hopefully fix the issue.

    regards,
    ben