Loccy
Joined: 28 Feb 2006 Posts: 1
|
Posted: Tue Feb 28, 2006 Post subject: Fix for the Outlook import add-in (plans_import.pl) |
|
|
Hi all,
Having had problems importing various Outlook calendars into Plans as a result of All Day Events getting mangled, I took a look at the code and was able to fix it.
Find the line
$event_end_timestamp = timegm(59,59,11,$end_mday,$end_month,$end_year);
and replace it with the two lines
$event_end_timestamp = timegm(59,59,23,$end_mday,$end_month,$end_year);
$event_end_timestamp = $event_end_timestamp - 86400;
Some notes for the curious:
The correction in the first line is because of what was probably an oversight on the original author's part (he's ending the all day event at 11:59AM and not 11:59PM or 23:59!). The second line is needed because all day events in Outlook are represented as an event that lasts from midnight to midnight. However what this means is that, strictly speaking, an Outlook all day event does actually span TWO days in that it runs into the second day by one second.
So, for example, if you had an all day event on Outlook that lasted one day, the 1st January, it would come in with a start time/date of January 1st 00:00, and it would finish on January 2nd 00:00.
However, plans_import.pl doesn't take the second point into account. So you end up with an all day event that goes on for an extra day.
So we simply declare the finishing date of the All Day Event to be 11:59:59 on the original finishing date (which will be a day on from what the finishing date SHOULD be), and we then deduct 86400 seconds to compensate for the extra erronenous day. |
|