Skip to content

Commit

Permalink
BUGFIX: ICSLink was not returning properly formatted dates
Browse files Browse the repository at this point in the history
  • Loading branch information
unclecheese committed Aug 13, 2012
1 parent 3b6bb9f commit 55a7ed7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions code/CalendarDateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,32 +143,40 @@ 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)
);
}
else if($this->Announcement()) {
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');
Expand Down

0 comments on commit 55a7ed7

Please sign in to comment.