File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
src/PhpSpreadsheet/Shared
tests/PhpSpreadsheetTests/Shared Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -172,10 +172,7 @@ public static function convertIsoDate(mixed $value): float|int
172
172
throw new Exception ("Invalid string $ value supplied for datatype Date " );
173
173
}
174
174
175
- $ newValue = self ::PHPToExcel ($ date );
176
- if ($ newValue === false ) {
177
- throw new Exception ("Invalid string $ value supplied for datatype Date " );
178
- }
175
+ $ newValue = self ::dateTimeToExcel ($ date );
179
176
180
177
if (preg_match ('/^\s*\d?\d:\d\d(:\d\d([.]\d+)?)?\s*(am|pm)?\s*$/i ' , $ value ) == 1 ) {
181
178
$ newValue = fmod ($ newValue , 1.0 );
Original file line number Diff line number Diff line change @@ -204,6 +204,9 @@ public function testVarious(): void
204
204
205
205
$ date = Date::PHPToExcel ('2020-01-01 ' );
206
206
self ::assertEquals (43831.0 , $ date );
207
+ $ phpDate = new DateTime ('2020-01-02T00:00Z ' );
208
+ $ date = Date::PHPToExcel ($ phpDate );
209
+ self ::assertEquals (43832.0 , $ date );
207
210
208
211
$ spreadsheet = new Spreadsheet ();
209
212
$ sheet = $ spreadsheet ->getActiveSheet ();
You can’t perform that action at this time.
0 commit comments