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);
Outputs:
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?
Cole