Skip to content

Instantly share code, notes, and snippets.

@georgehrke
Last active August 29, 2015 14:18
Show Gist options
  • Save georgehrke/c27be5982d8dd367cbdb to your computer and use it in GitHub Desktop.
Save georgehrke/c27be5982d8dd367cbdb to your computer and use it in GitHub Desktop.
BEGIN:VCALENDAR
PRODID:QIS-LSF HIS GmbH
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
END:VTIMEZONE
METHOD:PUBLISH
BEGIN:VEVENT
DTSTART;TZID=Europe/Berlin:20150409T130000
DTEND;TZID=Europe/Berlin:20150409T150000
RRULE:FREQ=WEEKLY;UNTIL=20150716T235900Z;INTERVAL=1;BYDAY=TH
EXDATE;TZID=Europe/Berlin:20150514T130000,20150528T130000,
DTSTAMP:20150405T143646Z
UID:6894690826
DESCRIPTION:
SUMMARY:23016
CATEGORIES:Vorlesung
END:VEVENT
BEGIN:VEVENT
DTSTART;TZID=Europe/Berlin:20150410T130000
DTEND;TZID=Europe/Berlin:20150410T150000
RRULE:FREQ=WEEKLY;UNTIL=20150717T235900Z;INTERVAL=2;BYDAY=FR
EXDATE;TZID=Europe/Berlin:
DTSTAMP:20150405T143646Z
UID:6894490823
DESCRIPTION:
SUMMARY:23017
CATEGORIES:Vorlesung
END:VEVENT
BEGIN:VEVENT
DTSTART;TZID=Europe/Berlin:20150409T110000
DTEND;TZID=Europe/Berlin:20150409T130000
RRULE:FREQ=WEEKLY;UNTIL=20150716T235900Z;INTERVAL=1;BYDAY=TH
EXDATE;TZID=Europe/Berlin:20150514T110000,20150528T110000
DTSTAMP:20150405T143646Z
UID:6895390843
DESCRIPTION:
SUMMARY:23013
CATEGORIES:Vorlesung
END:VEVENT
END:VCALENDAR
<?php
use Sabre\VObject;
require_once(__DIR__ . '/vendor/autoload.php');
date_default_timezone_set('UTC');
$vcalendar = VObject\Reader::read(
fopen('demo.ics','rb')
);
$validation = $vcalendar->validate();
foreach ($validation as $item) {
var_dump($item['message']);
}
echo json_encode($vcalendar->jsonSerialize());
[georgehrke@Georgs-MBP (23:22:51)  ~/Downloads/sabre-demo] php demo.php
string(80) "The supplied value (20150514T130000,20150528T130000,) is not a correct DATE-TIME"
string(48) "The supplied value () is not a correct DATE-TIME"
string(79) "The supplied value (20150514T110000,20150528T110000) is not a correct DATE-TIME"
PHP Notice: Uninitialized string offset: 0 in /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/DateTimeParser.php on line 183
Notice: Uninitialized string offset: 0 in /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/DateTimeParser.php on line 183
PHP Notice: Uninitialized string offset: 0 in /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/DateTimeParser.php on line 183
Notice: Uninitialized string offset: 0 in /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/DateTimeParser.php on line 183
PHP Fatal error: Uncaught exception 'LogicException' with message 'The supplied iCalendar datetime value is incorrect: ' in /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/DateTimeParser.php:40
Stack trace:
#0 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/DateTimeParser.php(188): Sabre\VObject\DateTimeParser::parseDateTime('', Object(DateTimeZone))
#1 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php(172): Sabre\VObject\DateTimeParser::parse('', Object(DateTimeZone))
#2 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php(275): Sabre\VObject\Property\ICalendar\DateTime->getDateTimes()
#3 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/Property.php(319): Sabre\VObject\Property\ICalendar\DateTime->getJsonValue()
#4 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/Component.php(336): Sabre\VObject\Property->jsonSerialize()
#5 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/ in /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/DateTimeParser.php on line 40
Fatal error: Uncaught exception 'LogicException' with message 'The supplied iCalendar datetime value is incorrect: ' in /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/DateTimeParser.php:40
Stack trace:
#0 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/DateTimeParser.php(188): Sabre\VObject\DateTimeParser::parseDateTime('', Object(DateTimeZone))
#1 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php(172): Sabre\VObject\DateTimeParser::parse('', Object(DateTimeZone))
#2 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php(275): Sabre\VObject\Property\ICalendar\DateTime->getDateTimes()
#3 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/Property.php(319): Sabre\VObject\Property\ICalendar\DateTime->getJsonValue()
#4 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/Component.php(336): Sabre\VObject\Property->jsonSerialize()
#5 /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/ in /Users/georgehrke/Downloads/sabre-demo/vendor/sabre/vobject/lib/DateTimeParser.php on line 40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment