From 27da222920081395a16229adb7dde8e032655858 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 28 Apr 2010 14:07:23 +1200 Subject: [PATCH] Override the DateTime::modify function with our own. Since it doesn't handle RRULE durations, but we want to do that. --- inc/RRule-v2.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/inc/RRule-v2.php b/inc/RRule-v2.php index f204e7f8..7e617cfb 100644 --- a/inc/RRule-v2.php +++ b/inc/RRule-v2.php @@ -141,6 +141,17 @@ class RepeatRuleDateTime extends DateTime { } + public function modify( $interval ) { + if ( preg_match('{^(-)?P((\d+)D)?T?((\d+)H)?((\d+)M)?$}', $interval, $matches) ) { + $interval = $matches[1]; + if ( isset($matches[2]) && $matches[2] != '' ) $interval .= $matches[3] . ' days '; + if ( isset($matches[4]) && $matches[4] != '' ) $interval .= $matches[5] . ' hours '; + if ( isset($matches[6]) && $matches[6] != '' ) $interval .= $matches[7] . ' minutes '; + } + return (string)parent::modify($interval); + } + + public function UTC() { $gmt = clone($this); if ( isset($this->tzid) && $this->tzid != 'UTC' ) {