Skip to content

Commit

Permalink
Use dbObject() for Dates/Times
Browse files Browse the repository at this point in the history
This fixes [Recoverable Error] Argument 1 passed to ICSWriter::getFormatedDateTime() must be an instance of Date, string given and returns the correct date. Also fixed DTEND line as it now uses EndDate and EndTime
  • Loading branch information
rsmclaren authored Jul 20, 2016
1 parent b440505 commit b769657
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/ICSWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ protected function addDateTime( CalendarDateTime $dateTime ) {
$this->addLine('BEGIN:VEVENT');
$this->addLine('UID:' . $this->getUID($dateTime) );
$this->addLine('DTSTAMP;TZID=' . Calendar::config()->timezone . ':' . $this->getFormatedDateTime());
$this->addLine('DTSTART;TZID=' . Calendar::config()->timezone . ':' . $this->getFormatedDateTime(new Date($dateTime->StartDate), new Time($dateTime->StartTime)));
$this->addLine('DTEND;TZID=' . Calendar::config()->timezone . ':' . $this->getFormatedDateTime(new Date($dateTime->StartDate), new Time($dateTime->StartTime)));
$this->addLine('DTSTART;TZID=' . Calendar::config()->timezone . ':' . $this->getFormatedDateTime($dateTime->dbObject('StartDate'), $dateTime->dbObject('StartTime')));
$this->addLine('DTEND;TZID=' . Calendar::config()->timezone . ':' . $this->getFormatedDateTime($dateTime->dbObject('EndDate'), $dateTime->dbObject('EndTime')));
$this->addLine('URL:' . Director::absoluteURL($dateTime->ICSLink()));
$this->addLine('SUMMARY:CHARSET=UTF-8:' . $dateTime->Event()->Title);
$this->addLine('END:VEVENT');
Expand Down

0 comments on commit b769657

Please sign in to comment.