diff options
Diffstat (limited to 'core/Period/Range.php')
-rw-r--r-- | core/Period/Range.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/Period/Range.php b/core/Period/Range.php index 2f1b33bdad..ba30cb9f36 100644 --- a/core/Period/Range.php +++ b/core/Period/Range.php @@ -18,12 +18,11 @@ */ class Piwik_Period_Range extends Piwik_Period { - public function __construct( $strPeriod, $strDate, $timezone = 'UTC' ) + public function __construct( $strPeriod, $strDate ) { $this->strPeriod = $strPeriod; $this->strDate = $strDate; $this->defaultEndDate = null; - $this->timezone = $timezone; } public function getLocalizedShortString() { @@ -72,6 +71,10 @@ class Piwik_Period_Range extends Piwik_Period case 'year': $startDate = $date->subMonth( 12 * $n ); break; + + default: + throw new Exception(sprintf(self::$unknowPeriodException, $this->strPeriod)); + break; } return $startDate; } @@ -122,7 +125,7 @@ class Piwik_Period_Range extends Piwik_Period } else { - $defaultEndDate = Piwik_Date::factory('now', $this->timezone); + $defaultEndDate = Piwik_Date::today(); } if($lastOrPrevious == 'last') { @@ -151,7 +154,7 @@ class Piwik_Period_Range extends Piwik_Period } else { - throw new Exception(Piwik_TranslateException('General_ExceptionInvalidDateRange', array($this->strDate, ' \'lastN\', \'previousN\', \'YYYY-MM-DD,YYYY-MM-DD\''))); + throw new Exception("The date '$this->strDate' is not a date range. Should have the following format: 'lastN' or 'previousN' or 'YYYY-MM-DD,YYYY-MM-DD'."); } $endSubperiod = Piwik_Period::factory($this->strPeriod, $endDate); |