×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Problem and solution - ics calendar file

Problem and solution - ics calendar file 10 years 1 month ago #25334

  • Scott King
  • Scott King's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 2
I have a site that is using the timezone America/Chicago (GMT-6) but now that we are in daylight savings, it's GMT-5. When I download a calendar file for an event, it's 6 hours later than it should be.

There were two problems. First, Matukio was retrieving the time for the ics file as GMT but the format of the time string was wrong. For GMT times to be interpreted properly by a program reading the ICS file, they need a "Z" at the end. For example:

DTSTART:20140326T193000Z
DTEND:20140326T213000Z


Another problem was that daylight savings time was not being interpreted properly. Using gmstrftime instead of strftime seems to fix the problem. Both fixes can be made to components/com_matukio/views/ics/tmpl/default.php. Replace lines 56, 57, and 58 with:
$icsdata .= "DTSTART:" . gmstrftime("%Y%m%dT%H%M%S", JFactory::getDate($event->begin)->toUnix()) . "Z\n";
$icsdata .= "DTEND:" . gmstrftime("%Y%m%dT%H%M%S", JFactory::getDate($event->end)->toUnix()) . "Z\n";
$icsdata .= "DTSTAMP:" . gmstrftime("%Y%m%dT%H%M%S", JFactory::getDate(MatukioHelperUtilsDate::getCurrentDate())->toUnix()) . "Z\n";

Problem and solution - ics calendar file 10 years 1 month ago #25378

  • Yves Hoppe
  • Yves Hoppe's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 3519
  • Karma: 71
  • Thank you received: 556
Hi Scott,

hmm interesting - we always retrieve GMT times (because all times are saved as that in the database) and then calculate it for the Joomla users timezone or when not logged in for the timezone in the Joomla configuration. Normally the same calculation should happen there too. Going to check again.

Thanks for your feedback!

Best regards

Yves
  • Page:
  • 1
Time to create page: 0.146 seconds