Skip to content

Commit cd15786

Browse files
committed
issue #2 add timezone parameter only if it's null
1 parent 7bbd99b commit cd15786

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/SapDateTime.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,17 @@ public static function createFromFormat(
8787
if ($format === static::SAP_WEEK) {
8888
return static::createFromSapWeek($time, $timezone);
8989
}
90+
if ($format === static::SAP_DATE && $timezone === null) {
91+
return parent::createFromFormat($format, $time)
92+
->setTime(0, 0, 0);
93+
}
9094
if ($format === static::SAP_DATE) {
9195
return parent::createFromFormat($format, $time, $timezone)
9296
->setTime(0, 0, 0);
9397
}
9498
if ($timezone === null) {
9599
return parent::createFromFormat($format, $time);
96100
}
97-
//@codeCoverageIgnoreStart
98101
return parent::createFromFormat($format, $time, $timezone);
99-
//@codeCoverageIgnoreEnd
100102
}
101103
}

0 commit comments

Comments
 (0)