(copied from the original discussion on this parser module: http://drupal.org/node/214688#comment-1114385)
The problem I'm having now is with all-day appointments. They are showing up in the Calendar view either on the day after they actually occur, or on both the day they occur and the next day. Here's what is in the ICS file, for example:
BEGIN:VEVENT
UID:84404659-870e-4fa9-a4c7-285810d1065e
SUMMARY:THANKSGIVING DAY
ORGANIZER;SENT-BY="mailto:someone@corporate.com":mailto:corporateevents@corporate.com
X-MS-OLK-SENDER;CN=Someone:mailto:someone@corporate.com
DTSTART;VALUE=DATE:20081127
DTEND;VALUE=DATE:20081128
STATUS:CONFIRMED
CLASS:PUBLIC
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
X-MICROSOFT-CDO-INTENDEDSTATUS:FREE
TRANSP:OPAQUE
X-MICROSOFT-DISALLOW-COUNTER:TRUE
DTSTAMP:20081105T162136Z
SEQUENCE:0
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER;RELATED=START:-PT1080M
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
So I see the end date is indeed the day after it should be, which I'm sure is the problem. However, there is also an indicator that it is an all-day appointment which I'm pretty sure is not being used. Tried not mapping the end date, and also mapping the end date to the start date (since most of our appointments for this calendar are all day), but doing either of those makes the dates not show up on the Calendar view at all.
I think I'm totally up-to-date on the iCal parser, the Date module (latest dev version) and the Calendar module (also latest dev version).
Any suggestions on what I could do to make this work?
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | parser_ical.module.txt | 4.66 KB | karens |
Comments
Comment #1
ekes commentedSeems it's not just Microsoft, this is the standard thing to do for events in units of days. Picking two holiday dates feeds at random, one from apple.com:
and one from mozilla.org
and for longer events on upcoming.com this event is from the 23rd until the 27th:-
So I'll try and work out the most sensible place to put the logic for making these flagged as whole day events.
Comment #2
ekes commentedFor the date module all day events as defined on theme output. The logic's in
theme_date_all_day(){It's all day (depending on granularity eg if it's second):- 00:00:00 -> 23:59:59 etc.
Thus if it's granularity is one day there isn't an all day event?
}
So should parser_ical:
a) subtract 1 second on detection of all day events (defined as events with no hh:mm:ss spreading over a period of a 'day' or more).
b) should it send more correct version of the ISO date (thus no hour:min:sec as it was passed) so that the date_mapper can deal with it as appropriate for the field it is going into?
I tend toward:
a) as the easier solution;
b) as the more correct solution ;-)
My biggest reservation about the addition of granularity to events where there was none is I can see timezone alterations then being done of them incorrectly.
a also assumes date field/date_mapper seem the wrong longer term assumption (although presently very true).
Any thoughts before diving to code?
Comment #3
karens commentedIf it's in use it's in use and has to be dealt with. We need a way to know to ignore that invalid end-date if this is an all-day date, so I'm looking for something that seems to be a reliable way of telling that we're dealing with an all-day event, and then I can code the date API to handle it correctly.
One thing that occurs as I look at these is that they both use DATE with a date that has no time (in the format YYYY-MM-DD). If that's a reliable way of identifying an all-day event, and any date that looks like that is an all-day date, I can add some code to deal with it. I need more examples of ical files that do and don't use 'All day' to be sure that looking for that will give me the right results.
Parser_ical should be able to rely on the Date API parser, I need to make this change there in Date API, and then parser_ical can just use the value that has been determined.
Comment #4
karens commentedI did some more looking at this and I think the Date API parser is getting this right (the 'all_day' flag is set), we just need to tweak parser_ical to deal correctly with all day days.
I was going to make a patch but the version in HEAD has windows line endings in it, so a patch would look like a bunch of garbage to fix all those line endings, but the place to fix is in parser_ical_parse() where it is adding date info to $item->options. We should add something like the following:
Then the date mapper needs some adjustments to deal correctly with these values if it encounters them.
That will format the date as YYYY-MM-DD with no timezone (all day events should have no timezone). Then we need to make some adjustments
Comment #5
karens commentedI've done some work to get the parser to handle RRULES and other things correctly and found we need to pass more info from the parser to the date field (see the discussion at #215979: Create a CCK date field mapper). I've reworked the parse code to change what is passed in and also flag it as coming from the VEVENT part of the CALENDAR so we can later add code to parse the VVENUE as well.
With this change in the parser, I can get repeating dates working in the mapper, at least the beginning of getting that working.
Comment #6
ekes commentedCheers.
Changes in DRUPAL-6--1 branch.
I'll port to 5, make releases etc. shortly.
Comment #7
ekes commentedDRUPAL-5 version done. Both in -dev versions. Will try to sync release with next date release.