aboutsummaryrefslogtreecommitdiff
path: root/lib/lib_date.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib_date.php')
-rw-r--r--lib/lib_date.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/lib_date.php b/lib/lib_date.php
index c1b40ecf6..70c1517af 100644
--- a/lib/lib_date.php
+++ b/lib/lib_date.php
@@ -63,6 +63,7 @@ function _dateCeiling(string $isoDate): string {
return $x[0] . 'T' . $t;
}
+/** @phpstan-return ($isoDate is null ? null : ($isoDate is '' ? null : string)) */
function _noDelimit(?string $isoDate): ?string {
return $isoDate === null || $isoDate === '' ? null : str_replace(array('-', ':'), '', $isoDate); //FIXME: Bug with negative time zone
}
@@ -70,7 +71,8 @@ function _noDelimit(?string $isoDate): ?string {
function _dateRelative(?string $d1, ?string $d2): ?string {
if ($d2 === null) {
return $d1 !== null && $d1[0] !== 'P' ? $d1 : null;
- } elseif ($d2 !== '' && $d2[0] != 'P' && $d1 !== null && $d1[0] !== 'P') {
+ }
+ if ($d2 !== '' && $d2[0] != 'P' && $d1 !== null && $d1[0] !== 'P') {
$y2 = substr($d2, 0, 4);
if (strlen($y2) < 4 || !ctype_digit($y2)) { //Does not start by a year
$d2 = _noDelimit($d2);