File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Component/Listing/Columns
Test/Unit/Component/Listing/Columns Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,9 @@ public function prepareDataSource(array $dataSource)
53
53
{
54
54
if (isset ($ dataSource ['data ' ]['items ' ])) {
55
55
foreach ($ dataSource ['data ' ]['items ' ] as & $ item ) {
56
- if (isset ($ item [$ this ->getData ('name ' )])) {
56
+ if (isset ($ item [$ this ->getData ('name ' )])
57
+ && $ item [$ this ->getData ('name ' )] !== "0000-00-00 00:00:00 "
58
+ ) {
57
59
$ date = $ this ->timezone ->date (new \DateTime ($ item [$ this ->getData ('name ' )]));
58
60
$ timezone = isset ($ this ->getConfiguration ()['timezone ' ])
59
61
? $ this ->booleanUtils ->convert ($ this ->getConfiguration ()['timezone ' ])
Original file line number Diff line number Diff line change @@ -89,4 +89,14 @@ public function testPrepareDataSource()
89
89
$ result = $ this ->model ->prepareDataSource (['data ' => ['items ' => [$ item ]]]);
90
90
$ this ->assertEquals (self ::TEST_TIME , $ result ['data ' ]['items ' ][0 ]['field_name ' ]);
91
91
}
92
+
93
+ public function testPrepareDataSourceWithZeroDate ()
94
+ {
95
+ $ zeroDate = '0000-00-00 00:00:00 ' ;
96
+ $ item = ['test_data ' => 'some_data ' , 'field_name ' => $ zeroDate ];
97
+ $ this ->timezoneMock ->expects ($ this ->never ())->method ('date ' );
98
+
99
+ $ result = $ this ->model ->prepareDataSource (['data ' => ['items ' => [$ item ]]]);
100
+ $ this ->assertEquals ($ zeroDate , $ result ['data ' ]['items ' ][0 ]['field_name ' ]);
101
+ }
92
102
}
You can’t perform that action at this time.
0 commit comments