Commit 330ae053 by Vladimir Zbrailov

remove timezone from i18n formatter

parent c8a9ed80
......@@ -69,11 +69,6 @@ class Formatter extends Component
public $thousandSeparator;
/**
* @var \DateTimeZone
*/
private $_timeZone;
/**
* Initializes the component.
*/
public function init()
......@@ -82,9 +77,9 @@ class Formatter extends Component
$this->timeZone = Yii::$app->timeZone;
}
if (is_string($this->timeZone)) {
$this->_timeZone = new \DateTimeZone($this->timeZone);
} elseif ($this->_timeZone instanceof IntlTimeZone) {
$this->_timeZone = $this->timeZone->toDateTimeZone();
$this->timeZone = new \DateTimeZone($this->timeZone);
} elseif ($this->timeZone instanceof IntlTimeZone) {
$this->timeZone = $this->timeZone->toDateTimeZone();
}
if (empty($this->booleanFormat)) {
......@@ -356,7 +351,7 @@ class Formatter extends Component
{
$date = new DateTime();
$date->setTimestamp($value);
$date->setTimezone($this->_timeZone);
$date->setTimezone($this->timeZone);
return $date->format($format);
}
......
......@@ -39,15 +39,6 @@ class Formatter extends \yii\base\Formatter
*/
public $locale;
/**
* @var string|\IntlTimeZone|\DateTimeZone the timezone to use for formatting time and date values.
* This can be any value that may be passed to [date_default_timezone_set()](http://www.php.net/manual/en/function.date-default-timezone-set.php)
* e.g. `UTC`, `Europe/Berlin` or `America/Chicago`.
* Refer to the [php manual](http://www.php.net/manual/en/timezones.php) for available timezones.
* This can also be an IntlTimeZone or a DateTimeZone object.
* If not set, [[\yii\base\Application::timezone]] will be used.
*/
public $timeZone;
/**
* @var string the default format string to be used to format a date.
* This can be "short", "medium", "long", or "full", which represents a preset format of different lengths.
* It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime).
......@@ -98,9 +89,6 @@ class Formatter extends \yii\base\Formatter
if ($this->locale === null) {
$this->locale = Yii::$app->language;
}
if ($this->timeZone === null) {
$this->timeZone = Yii::$app->timeZone;
}
if ($this->decimalSeparator === null || $this->thousandSeparator === null) {
$formatter = new NumberFormatter($this->locale, NumberFormatter::DECIMAL);
if ($this->decimalSeparator === null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment