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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
074fd809
Commit
074fd809
authored
Apr 20, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3194 from kartik-v/patch-16
Fix the Y2K38 bug
parents
ad7f57de
82aedfb2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
Formatter.php
framework/base/Formatter.php
+10
-4
No files found.
framework/CHANGELOG.md
View file @
074fd809
...
...
@@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.
0.0-rc under development
--------------------------
-
Bug #3194: Date formatter works only for timestamps in the year range 1970 to 2038.
-
Bug #2563: Theming is not working if the path map of the theme contains ".." or "." in the paths (qiangxue)
-
Bug #2801: Fixed the issue that GridView gets footer content before data cells content (ElisDN)
-
Bug #3042:
`yii\widgets\Pjax`
should end application right after it finishes responding to a pjax request (qiangxue)
...
...
framework/base/Formatter.php
View file @
074fd809
...
...
@@ -342,18 +342,24 @@ class Formatter extends Component
/**
* Normalizes the given datetime value as one that can be taken by various date/time formatting methods.
*
* @param mixed $value the datetime value to be normalized.
* @return integer the normalized datetime value
*/
protected
function
normalizeDatetimeValue
(
$value
)
{
if
(
is_string
(
$value
))
{
return
is_numeric
(
$value
)
||
$value
===
''
?
(
int
)
$value
:
strtotime
(
$value
);
if
(
is_numeric
(
$value
)
||
$value
===
''
)
{
$value
=
(
double
)
$value
;
}
else
{
$date
=
new
DateTime
(
$value
);
$value
=
$date
->
format
(
'U'
);
}
return
$value
;
}
elseif
(
$value
instanceof
DateTime
||
$value
instanceof
\DateTimeInterface
)
{
/** @var $value \DateTimeInterface */
return
$value
->
getTimestamp
();
return
$value
->
format
(
'U'
);
}
else
{
return
(
int
)
$value
;
return
(
double
)
$value
;
}
}
...
...
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