-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes all day events and adds getter for Event::getDtStart
#83
Conversation
added missing dtStart getter
Where the end date must be the day after the start date.
getDtStart
getter function from Event
Event::getDtStart
Thanks for the contribution! |
Since we upgraded to 0.11.3 from 0.10.1 all the all-day events in our feeds now span one day more than they should.. I don't know what this bugfix was based on, but I think it's fine for all day events to start and end on the same day. The +1 day that's done in this PR seems to mess up the feeds. I'd be curious to hear why it was done, and whether it can be reverted. |
@Seldaek does that affect only "single-day" events or also "multi-day" events? According to the RFC the dtend is "not-inclusive".
I will check that also for myself tomorrow. |
Here is a sample of what we got after upgrading the lib (in pink) and importing the new feed, so yes all all-day events became one day longer. At least in outlook. I haven't checked other tools in depth. I just find it kinda weird that this would not have been noticed as a problem before now if all-day events were exported to ical a day short. @buggedcom Did you do the fix because you hit an issue or was it just out of spec-compliance's sake? |
@Seldaek hey, I checked it again with Calendar. This was my testcase (based on <?php
// use composer autoloader
require_once __DIR__ . '/../vendor/autoload.php';
// set default timezone (PHP 5.4)
date_default_timezone_set('Europe/Berlin');
// 1. Create new calendar
$vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com');
// 2. Create an event
$vEvent = new \Eluceo\iCal\Component\Event();
$vEvent->setDtStart(new \DateTime('2017-12-24'));
$vEvent->setDtEnd(new \DateTime('2017-12-26'));
$vEvent->setNoTime(true);
$vEvent->setSummary('Christmas: 24., 25. and 26. of December');
// Adding Timezone (optional)
$vEvent->setUseTimezone(true);
// 3. Add event to calendar
$vCalendar->addComponent($vEvent);
// 4. Set headers
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename="cal.ics"');
// 5. Output
echo $vCalendar->render(); That produces the following output:
Imported into calendar it looks fine (my intention was to create a multi-day event on 24th, 25th and 26th of december: The other event in green was a test for a single-day event on 24th of december. Can you confirm the same usage of the |
Oh well, now I feel silly but I looked at our code to see where we declare all day (noTime) events, and I see we do this:
So I guess that last line was added as a workaround for the bug, and obviously it causes issues now the bug is fixed.. Sorry about the noise, I wasn't aware of that. The fix looks good then :) |
@Seldaek haha, no worries. Actually the API in this package failed because it is confusing. When I will work on the documentation I will add some propper explanation about the meaning of the methods. |
All day events should always end the next day. Additionally the tzid should not be applied to all day events.
And added a missing
getDtStart
getter function to theEvent
component.