Skip to content

Commit aeb9c23

Browse files
committed
Fixed work with empty Date/Time
1 parent 967a51e commit aeb9c23

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/AbraFlexi/Date.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ public function __construct(string $flexidate = 'NOW') {
3939
} elseif ( !empty ($flexidate) && ($flexidate != 'NOW')) {
4040
$format = RO::$DateFormat;
4141
}
42+
if(strstr($flexidate, ':')){ // ?!?!?
43+
$flexidate = substr($flexidate,0, -6);
44+
}
4245
parent::__construct(empty($format) ? null : \DateTime::createFromFormat($format, $flexidate)->setTime(0, 0)->format(\DateTimeInterface::ATOM));
4346
}
4447

src/AbraFlexi/DateTime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(string $flexidatetime = 'NOW') {
3434
$format = '';
3535
if (strchr($flexidatetime, '.')) { //NewFormat
3636
$format = RO::$DateTimeFormat;
37-
} elseif ($flexidatetime != 'NOW') { // Old format
37+
} elseif ( !empty ($flexidatetime) && ($flexidatetime != 'NOW')) { // Old format
3838
$format = 'Y-m-d\TH:i:s+P';
3939
}
4040
parent::__construct(empty($format) ? null : \DateTime::createFromFormat($format, $flexidatetime)->format(\DateTimeInterface::ATOM));

0 commit comments

Comments
 (0)