From bd10ff1266689b85ce371f7f0ab741d91addf42c Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Fri, 29 Oct 2010 12:58:19 +0200 Subject: [PATCH] add setUntil() method --- helpers/SG_iCal_Recurrence.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/helpers/SG_iCal_Recurrence.php b/helpers/SG_iCal_Recurrence.php index fc22898..bcc05ac 100755 --- a/helpers/SG_iCal_Recurrence.php +++ b/helpers/SG_iCal_Recurrence.php @@ -80,6 +80,18 @@ class SG_iCal_Recurrence { } } + /** + * Set the $until member + * @param mixed timestamp (int) / Valid DateTime format (string) + */ + public function setUntil($ts) { + if ( is_int($ts) ) + $dt = new DateTime('@'.$ts); + else + $dt = new DateTime($ts); + $this->until = $dt->format('Ymd\THisO'); + } + /** * Retrieves the desired member variable and returns it (if it's set) * @param string $member name of the member variable @@ -106,7 +118,6 @@ class SG_iCal_Recurrence { * @return mixed string if the member has been set, false otherwise */ public function getUntil() { - return $this->getMember('until'); }