Comments (6)
Yep - this fixes the problem. Didn't noticed that there's a new version avaiable ;-)
Thank you & keep up this great work...
kaju
from ical.
Guten Morgen Marc,
how does the code look like that generates the iCal file? Do you have an example?
Maybe you can try to turn of the timezone because you have an all day event:
$vEvent->setUseTimezone(false);
from ical.
HI.
This makes no difference....so here's my full code:
`
public function ical($id)
{
// try to find user by id
$user = User::...;
// create new calendar
$calendar = new Calendar('URL');
$calendar->setName('Calendar Name');
$calendar->setCalId(hash('ripemd160', $user->id));
$calendar->setDescription('Calender Description');
$calendar->setPublishedTTL('PT30M');
// set default timezone
$tz = config('app.timezone');
$dtz = new \DateTimeZone($tz);
// create daylight recurrence role
$daylight_recurrence = new RecurrenceRule();
$daylight_recurrence->setFreq(RecurrenceRule::FREQ_YEARLY);
$daylight_recurrence->setByMonth(3);
$daylight_recurrence->setByDay('-1SU');
// create daylight timezone rule
$daylight_timezone = new TimezoneRule(TimezoneRule::TYPE_DAYLIGHT);
$daylight_timezone->setTzName('CEST');
$daylight_timezone->setDtStart(new DateTime('1981-03-29 02:00:00', $dtz));
$daylight_timezone->setTzOffsetFrom('+0100');
$daylight_timezone->setTzOffsetTo('+0200');
$daylight_timezone->setRecurrenceRule($daylight_recurrence);
// create standard recurrence role
$standard_recurrence = new RecurrenceRule();
$standard_recurrence->setFreq(RecurrenceRule::FREQ_YEARLY);
$standard_recurrence->setByMonth(10);
$standard_recurrence->setByDay('-1SU');
// create standard timezone rule
$standard_timezone = new TimezoneRule(TimezoneRule::TYPE_STANDARD);
$standard_timezone->setTzName('CET');
$standard_timezone->setDtStart(new DateTime('1996-10-27 03:00:00', $dtz));
$standard_timezone->setTzOffsetFrom('+0200');
$standard_timezone->setTzOffsetTo('+0100');
$standard_timezone->setRecurrenceRule($standard_recurrence);
// create timezone
$timezone = new Timezone($tz);
$timezone->addComponent($daylight_timezone);
$timezone->addComponent($standard_timezone);
$calendar->setTimezone($timezone);
/**
* Iterate through all items.
*
* @var Event $item
*/
foreach ($items as $item) {
// create new calendar
$event = new \Eluceo\iCal\Component\Event();
// set summary
$event->setSummary($item->title);
// set start- and end date/time
$event->setDtStart($item->start_at);
$event->setDtEnd($item->end_at);
// distribute time part?
$event->setNoTime(!(
($item->start_at) && ($item->start_at->format('H:i') !== '00:00') ||
($item->end_at) && ($item->end_at->format('H:i') !== '00:00')
));
// location info available?
if ($location = $item->location) {
// add geo location?
$geo = $location->latitude && $location->longitude
? sprintf('%s;%s', $location->latitude, $location->longitude)
: null;
// add location to event
$event->setLocation($location->name, $location->name, $geo);
}
// add timezone support
$event->setUseTimezone(true);
// add event to calendar
$calendar->addComponent($event);
}
// set http header
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename="iCal.ics"');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
// return rendered calendar
return $calendar->render();
}
`
Best regards (Liebe Grüße),
Marc
from ical.
Hi.
Any progress here or should I try to fix it myself, if you haven't time?
Best regards,
Marc
from ical.
@kaju74 please feel free to contribute a fix if you can. This is an open source project that I am maintaining in my freetime. I am happy about every contribution.
Regarding your generated iCal file. The DTSTART;TZID=Europe/Berlin;VALUE=DATE:20170630
property cotains the timezone. That was removed in newer version of this library. Can you check if you can update to a newer version?
from ical.
Funnily in this issue it is reported that the event is to short and in #83 @Seldaek found out that events are to long.
from ical.
Related Issues (20)
- Compatibility with PHP 8.1 HOT 1
- 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
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.