Improve parsing years in MDPlausiEvent

This commit is contained in:
Joshua Ramon Enslin 2023-10-07 22:38:27 +02:00
parent 611afb7944
commit 11c61525e0
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -37,8 +37,8 @@ final class MDPlausiEvent {
if (empty($time)) return ['earliest' => false, 'latest' => false];
// 2005
if (in_array(strlen($time), [4, 5], true) and is_numeric(substr($time, 1))) {
// 20, -1, 233, -233, 2005, -2005
if (in_array(strlen($time), [2, 3, 4, 5], true) and is_numeric(substr($time, 1))) {
return [
'earliest' => strtotime($time . '-01-01'),
'latest' => strtotime($time . '-12-31'),