diff --git a/code/CalendarDateTime.php b/code/CalendarDateTime.php index 33d6c5c..b59d0d4 100755 --- a/code/CalendarDateTime.php +++ b/code/CalendarDateTime.php @@ -143,12 +143,19 @@ public function MicroformatEnd($offset = true) { public function ICSLink() { + $ics_start = $this->obj('StartDate')->Format('Ymd')."T".$this->obj('StartTime')->Format('His'); + if($this->EndDate) { + $ics_end = $this->obj('EndDate')->Format('Ymd')."T".$this->obj('EndTime')->Format('His'); + } + else { + $ics_end = $ics_start; + } if($this->Feed) { return Controller::join_links( $this->Calendar()->Link(), "ics", $this->ID, - $this->MicroformatStart(false) . "-" . $this->MicroformatEnd(false), + $ics_start . "-" . $ics_end, "?title=".urlencode($this->Title) ); } @@ -156,19 +163,20 @@ public function ICSLink() { return Controller::join_links( $this->Calendar()->Link(), "ics","announcement-".$this->ID, - $this->MicroformatStart(false) . "-" . $this->MicroformatEnd(false) + $ics_start . "-" . $ics_end ); } return Controller::join_links( $this->Event()->Parent()->Link(), "ics", $this->Event()->ID, - $this->MicroformatStart(false) . "-" . $this->MicroformatEnd(false) + $ics_start . "-" . $ics_end ); } + public function getFormattedStartDate() { if(!$this->StartDate) return "--"; return CalendarUtil::get_date_format() == "mdy" ? $this->obj('StartDate')->Format('m-d-Y') : $this->obj('StartDate')->Format('d-m-Y');