Fixed getting of dates in Česká televize Bridge

This commit is contained in:
Petr Kolář 2025-03-20 10:02:56 +01:00
parent dee734d360
commit 9024dfd61a

View File

@ -58,11 +58,11 @@ class CeskaTelevizeBridge extends BridgeAbstract
return strtotime('today'); return strtotime('today');
} elseif (strpos($string, 'včera') !== false) { } elseif (strpos($string, 'včera') !== false) {
return strtotime('yesterday'); return strtotime('yesterday');
} elseif (!preg_match('/(\d+).\s(\d+).(\s(\d+))?/', $string, $match)) { } elseif (!preg_match('/(\d+).\s(\d+).(\s(\d+))?/u', $string, $match)) {
returnServerError('Could not get date from Česká televize string'); returnServerError('Could not get date from Česká televize string');
} }
$date = sprintf('%04d-%02d-%02d', $match[3] ?? date('Y'), $match[2], $match[1]); $date = sprintf('%04d-%02d-%02d', $match[4] ?? date('Y'), $match[2], $match[1]);
return strtotime($date); return strtotime($date);
} }