Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
330ae053
Commit
330ae053
authored
Jan 26, 2014
by
Vladimir Zbrailov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove timezone from i18n formatter
parent
c8a9ed80
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
21 deletions
+4
-21
Formatter.php
framework/base/Formatter.php
+4
-9
Formatter.php
framework/i18n/Formatter.php
+0
-12
No files found.
framework/base/Formatter.php
View file @
330ae053
...
@@ -69,11 +69,6 @@ class Formatter extends Component
...
@@ -69,11 +69,6 @@ class Formatter extends Component
public
$thousandSeparator
;
public
$thousandSeparator
;
/**
/**
* @var \DateTimeZone
*/
private
$_timeZone
;
/**
* Initializes the component.
* Initializes the component.
*/
*/
public
function
init
()
public
function
init
()
...
@@ -82,9 +77,9 @@ class Formatter extends Component
...
@@ -82,9 +77,9 @@ class Formatter extends Component
$this
->
timeZone
=
Yii
::
$app
->
timeZone
;
$this
->
timeZone
=
Yii
::
$app
->
timeZone
;
}
}
if
(
is_string
(
$this
->
timeZone
))
{
if
(
is_string
(
$this
->
timeZone
))
{
$this
->
_
timeZone
=
new
\DateTimeZone
(
$this
->
timeZone
);
$this
->
timeZone
=
new
\DateTimeZone
(
$this
->
timeZone
);
}
elseif
(
$this
->
_
timeZone
instanceof
IntlTimeZone
)
{
}
elseif
(
$this
->
timeZone
instanceof
IntlTimeZone
)
{
$this
->
_
timeZone
=
$this
->
timeZone
->
toDateTimeZone
();
$this
->
timeZone
=
$this
->
timeZone
->
toDateTimeZone
();
}
}
if
(
empty
(
$this
->
booleanFormat
))
{
if
(
empty
(
$this
->
booleanFormat
))
{
...
@@ -356,7 +351,7 @@ class Formatter extends Component
...
@@ -356,7 +351,7 @@ class Formatter extends Component
{
{
$date
=
new
DateTime
();
$date
=
new
DateTime
();
$date
->
setTimestamp
(
$value
);
$date
->
setTimestamp
(
$value
);
$date
->
setTimezone
(
$this
->
_
timeZone
);
$date
->
setTimezone
(
$this
->
timeZone
);
return
$date
->
format
(
$format
);
return
$date
->
format
(
$format
);
}
}
...
...
framework/i18n/Formatter.php
View file @
330ae053
...
@@ -39,15 +39,6 @@ class Formatter extends \yii\base\Formatter
...
@@ -39,15 +39,6 @@ class Formatter extends \yii\base\Formatter
*/
*/
public
$locale
;
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.
* @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.
* 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).
* 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
...
@@ -98,9 +89,6 @@ class Formatter extends \yii\base\Formatter
if
(
$this
->
locale
===
null
)
{
if
(
$this
->
locale
===
null
)
{
$this
->
locale
=
Yii
::
$app
->
language
;
$this
->
locale
=
Yii
::
$app
->
language
;
}
}
if
(
$this
->
timeZone
===
null
)
{
$this
->
timeZone
=
Yii
::
$app
->
timeZone
;
}
if
(
$this
->
decimalSeparator
===
null
||
$this
->
thousandSeparator
===
null
)
{
if
(
$this
->
decimalSeparator
===
null
||
$this
->
thousandSeparator
===
null
)
{
$formatter
=
new
NumberFormatter
(
$this
->
locale
,
NumberFormatter
::
DECIMAL
);
$formatter
=
new
NumberFormatter
(
$this
->
locale
,
NumberFormatter
::
DECIMAL
);
if
(
$this
->
decimalSeparator
===
null
)
{
if
(
$this
->
decimalSeparator
===
null
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment