Has anyone got any experience working with iCal feeds - I have written a plugin utilising the CalFileParser library but the UK clock changes have thrown all the items out, so eg an all day event is now showing up as at 11pm the day before. For example:

BEGIN:VEVENT DTEND:20170418T230000Z DTSTAMP:20170412T114209Z DTSTART:20170418T230000Z SEQUENCE:0 SUMMARY:F4 Careers Day UID:65d28288-9ba7-404c-85fe-b66682e2f605 END:VEVENT

Is importing as 23:00 on 18/04/2017. However importing the feed into Calendar (Mac) is reporting the event as expected at 00:00 on 19/04/2017.

If I update my site settings to BST (UTC+1) and parse the value into a DateTime object then it outputs to screen correctly, eg:

$tmp = DateTime::createFromString($item['dtstart']->date);


Craft\DateTime Object ( [date] => 2017-04-19 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/London )

However, on saving to my database record (to a column with AttributeType::DateTime) this date value is saved as 2017-04-18 23:00:00. This means that any attempt to retrieve and show this on my site outputs the wrong date/time.

Any thoughts on how to get my script to acknowledge the time difference and save this to the relevant record without having to tinker with the code every 6 months?


1 Answer 1


This sounds like that CalFileParser library you are using has some issues with timezones. There is a pull-request that supposedly fixes these, but I would rather exchange it for another library.

https://github.com/u01jmg3/ics-parser has the more modern codebase, seems to be actively maintained, more used, and can be installed using composer.

  • Thanks @carlcs - indeed was a problem with the CalFileParser plugin. There was a recent Pull Request that updating to resolved. When time permits will try to move to a more recent codebase. Commented Apr 13, 2017 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.