Skip to content

Commit 6f8814f

Browse files
committed
issue #7 return null in case the date value consists only of zeros
1 parent 539a865 commit 6f8814f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Api/Element.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ public function cast($value)
127127
if ($methods === null) {
128128
$methods = [
129129
self::TYPE_DATE => static function ($value) {
130+
/**
131+
* In case the date value consists only of zeros, this
132+
* is most likely a mistake of the SAP remote function.
133+
*/
134+
if (preg_match('~^[0]+$~', $value)) {
135+
return null;
136+
}
130137
return SapDateTime::createFromFormat(SapDateTime::SAP_DATE, $value);
131138
},
132139
self::TYPE_TIME => static function ($value) {

0 commit comments

Comments
 (0)