Comments (12)
@markuspoerschke I've fixed it. I've added the extra code from example 5 and made my events using datetime.
public function getIcal($token = null)
{
$user = $this->userRepository->getByToken($token);
$vCalendar = new Calendar('www.onderwijsonline.nl');
$vCalendar->setPublishedTTL('PT15M');
// set default timezone (PHP 5.4)
$tz = 'Europe/Amsterdam';
$dtz = new \DateTimeZone($tz);
date_default_timezone_set($tz);
// 2. Create timezone rule object for Daylight Saving Time
$vTimezoneRuleDst = new TimezoneRule(TimezoneRule::TYPE_DAYLIGHT);
$vTimezoneRuleDst->setTzName('CEST');
$vTimezoneRuleDst->setDtStart(new \DateTime('1981-03-29 02:00:00', $dtz));
$vTimezoneRuleDst->setTzOffsetFrom('+0100');
$vTimezoneRuleDst->setTzOffsetTo('+0200');
$dstRecurrenceRule = new RecurrenceRule();
$dstRecurrenceRule->setFreq(RecurrenceRule::FREQ_YEARLY);
$dstRecurrenceRule->setByMonth(3);
$dstRecurrenceRule->setByDay('-1SU');
$vTimezoneRuleDst->setRecurrenceRule($dstRecurrenceRule);
// 3. Create timezone rule object for Standard Time
$vTimezoneRuleStd = new TimezoneRule(TimezoneRule::TYPE_STANDARD);
$vTimezoneRuleStd->setTzName('CET');
$vTimezoneRuleStd->setDtStart(new \DateTime('1996-10-27 03:00:00', $dtz));
$vTimezoneRuleStd->setTzOffsetFrom('+0200');
$vTimezoneRuleStd->setTzOffsetTo('+0100');
$stdRecurrenceRule = new RecurrenceRule();
$stdRecurrenceRule->setFreq(RecurrenceRule::FREQ_YEARLY);
$stdRecurrenceRule->setByMonth(10);
$stdRecurrenceRule->setByDay('-1SU');
$vTimezoneRuleStd->setRecurrenceRule($stdRecurrenceRule);
// 4. Create timezone definition and add rules
$vTimezone = new Timezone($tz);
$vTimezone->addComponent($vTimezoneRuleDst);
$vTimezone->addComponent($vTimezoneRuleStd);
$vCalendar->setTimezone($vTimezone);
if (!is_null($user)) {
/**
* Calendar events
*/
$events = $this->calendarRepository->getEventsForUser($user->id, Carbon::now()->subWeeks(2), Carbon::now()->addWeeks(6));
foreach ($events as $event) {
$vEvent = new Event();
$vEvent
->setUseTimezone(true)
->setUseUtc(false)
->setDtStart(new \DateTime(Carbon::parse($event['start']), $dtz))
->setDtEnd(new \DateTime(Carbon::parse($event['end'])))
->setNoTime(($event['allDay'] == 1 ? true : false))
->setUrl($event['href'])
->setDescription($event['description'])
->setSummary($event['title']);
$vCalendar->addComponent($vEvent);
}
/**
* Project events
*/
$events = $this->calendarRepository->getEventsForProjects($user->id, null, null);
foreach ($events as $event) {
$vEvent = new Event();
$vEvent
->setUseTimezone(true)
->setUseUtc(false)
->setDtStart(new \DateTime(Carbon::parse($event['start']), $dtz))
->setDtEnd(new \DateTime(Carbon::parse($event['end'])))
->setNoTime(($event['allDay'] == 1 ? true : false))
->setUrl($event['href'])
->setSummary($event['title']);
$vCalendar->addComponent($vEvent);
}
/**
* Timetable events
*/
$events = $this->calendarRepository->getEventsForTimetables($user->id, Carbon::now()->startOfWeek(), Carbon::now()->startOfWeek()->addWeeks(4));
foreach ($events as $event) {
$vEvent = new Event();
$vEvent
->setUseTimezone(true)
->setUseUtc(false)
->setDtStart(new \DateTime(Carbon::parse($event['start']), $dtz))
->setDtEnd(new \DateTime(Carbon::parse($event['end'])))
->setNoTime(($event['allDay'] == 1 ? true : false))
->setSummary($event['title']);
$vCalendar->addComponent($vEvent);
}
}
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: inline; filename=onderwijsonline.ics');
return $vCalendar->render();
}
from ical.
from ical.
There is no DTSTART
within the generated ical file (the file in the issue description above). Which version do you use? Maybe this is fixed for all day events in #83 ?
from ical.
Version that is being used is: 0.10. I just updated to 0.11.* on the servers, which is on the url I mentioned above. But still no luck on Outlook.
from ical.
Could there be an issue in the protocol that is being used? In every example outlook uses webcal://
, not https://
or http://
.
from ical.
You said this is being output to a url? Are there any other headers?
from ical.
@fh-jashmore all headers are set as said in the documentation.
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: inline; filename=onderwijsonline.ics');
from ical.
What's the progress for this issue? @markuspoerschke
from ical.
@KevinHoughton I just tested the URL above and the events are working in Appleโs calendar. There I can see the events. Sadly I have no access to Outlook where I could test your file. To mee it looks good. I will attach a screenshot how it looks like to me.
from ical.
Did you try to simplify the calendar file for outlook? Mayb you can first start with a simple event with title and time only. And later on you could enable timezone etc. Maybe that could be a possibility to dissect and finally find the problem.
from ical.
I spent around 8 hours trying to duplicate outlook files that were working with outlook. I couldn't figure it out. And I tried simple stuff. I'm not 100% sure its the calendar file.
from ical.
Maybe this helps?
from ical.
Related Issues (20)
- Adding custom Calendar properties is not possible without code duplication HOT 4
- Calendar app on the Mac does not accept this ics. HOT 6
- Geographic position is always NULL HOT 1
- No exist Method property in EventFactory HOT 4
- The organizer's e-mail changes the @ to %40 HOT 2
- ICS and calendar agent causing a lot of requests for past events on my asp.net mvc endpoint
- eluceo/ical 2.7.0 conflicts with php 7.4.6 HOT 1
- Invalid iCal generated when DateTimeZone is UTC
- How to cancel an event
- iCal in one line HOT 2
- Cannot set BYMONTHDAY to a comma-separated list
- UTC Format sometimes not recognized on some calendars HOT 2
- Set organizer not working properly
- Reporting a vulnerability
- SSL certificate expired
- Not working with Outlook Calendar
- [FEATURE] Enable TimeSpan work with only start Time
- Psalm error when trying to create a date object
- Documentation link is broken HOT 3
- Invalid TZID value or missing VTIMEZONE component (Europe/Paris)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ical.