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
03351ccb
Commit
03351ccb
authored
Jan 10, 2015
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added explicit test for the Y2K38 problem
http://en.wikipedia.org/wiki/Year_2038_problem
parent
2a19b3ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
FormatterDateTest.php
tests/unit/framework/i18n/FormatterDateTest.php
+9
-1
No files found.
tests/unit/framework/i18n/FormatterDateTest.php
View file @
03351ccb
...
...
@@ -192,6 +192,10 @@ class FormatterDateTest extends TestCase
*/
public
function
testDateRangeLow
()
{
// http://en.wikipedia.org/wiki/Year_2038_problem
$this
->
assertSame
(
'13-12-1901'
,
$this
->
formatter
->
asDate
(
'1901-12-13'
,
'dd-MM-yyyy'
));
$this
->
assertSame
(
'12-12-1901'
,
$this
->
formatter
->
asDate
(
'1901-12-12'
,
'dd-MM-yyyy'
));
$this
->
assertSame
(
'12-08-1922'
,
$this
->
formatter
->
asDate
(
'1922-08-12'
,
'dd-MM-yyyy'
));
$this
->
assertSame
(
'14-01-1732'
,
$this
->
formatter
->
asDate
(
'1732-01-14'
,
'dd-MM-yyyy'
));
$this
->
assertSame
(
'01-01-0000'
,
$this
->
formatter
->
asDate
(
'0000-01-01'
,
'dd-MM-yyyy'
));
...
...
@@ -203,12 +207,16 @@ class FormatterDateTest extends TestCase
$this
->
testDateRangeHigh
();
}
/**
/**
* Test for dates after 2038
* https://github.com/yiisoft/yii2/issues/3126
*/
public
function
testDateRangeHigh
()
{
// http://en.wikipedia.org/wiki/Year_2038_problem
$this
->
assertSame
(
'19-01-2038'
,
$this
->
formatter
->
asDate
(
'2038-01-19'
,
'dd-MM-yyyy'
));
$this
->
assertSame
(
'20-01-2038'
,
$this
->
formatter
->
asDate
(
'2038-01-20'
,
'dd-MM-yyyy'
));
$this
->
assertSame
(
'17-12-2048'
,
$this
->
formatter
->
asDate
(
'2048-12-17'
,
'dd-MM-yyyy'
));
$this
->
assertSame
(
'17-12-3048'
,
$this
->
formatter
->
asDate
(
'3048-12-17'
,
'dd-MM-yyyy'
));
$this
->
assertSame
(
'31-12-9999'
,
$this
->
formatter
->
asDate
(
'9999-12-31'
,
'dd-MM-yyyy'
));
...
...
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