Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/Period/Range.php')
-rw-r--r--core/Period/Range.php11
1 files changed, 4 insertions, 7 deletions
diff --git a/core/Period/Range.php b/core/Period/Range.php
index ba30cb9f36..2f1b33bdad 100644
--- a/core/Period/Range.php
+++ b/core/Period/Range.php
@@ -18,11 +18,12 @@
*/
class Piwik_Period_Range extends Piwik_Period
{
- public function __construct( $strPeriod, $strDate )
+ public function __construct( $strPeriod, $strDate, $timezone = 'UTC' )
{
$this->strPeriod = $strPeriod;
$this->strDate = $strDate;
$this->defaultEndDate = null;
+ $this->timezone = $timezone;
}
public function getLocalizedShortString()
{
@@ -71,10 +72,6 @@ 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;
}
@@ -125,7 +122,7 @@ class Piwik_Period_Range extends Piwik_Period
}
else
{
- $defaultEndDate = Piwik_Date::today();
+ $defaultEndDate = Piwik_Date::factory('now', $this->timezone);
}
if($lastOrPrevious == 'last')
{
@@ -154,7 +151,7 @@ class Piwik_Period_Range extends Piwik_Period
}
else
{
- 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'.");
+ throw new Exception(Piwik_TranslateException('General_ExceptionInvalidDateRange', array($this->strDate, ' \'lastN\', \'previousN\', \'YYYY-MM-DD,YYYY-MM-DD\'')));
}
$endSubperiod = Piwik_Period::factory($this->strPeriod, $endDate);