Fix date parsing error

This commit is contained in:
Sebastian Meyer 2024-05-10 15:02:28 +02:00
parent c4a5a09205
commit a142f9fdfb
1 changed files with 7 additions and 3 deletions

View File

@ -283,10 +283,14 @@ class Server {
} }
private function formatTimestamp($datestamp) { private function formatTimestamp($datestamp) {
if (is_array($time = date_parse_from_format('Y-m-d\TH:i:s\Z', $datestamp)) || is_array($time = date_parse_from_format('Y-m-d\TH:i:s\Z', $datestamp))) { $time = date_parse_from_format('Y-m-d\TH:i:s\Z', $datestamp);
return gmmktime($time['hour'], $time['minute'], $time['second'], $time['month'] + 1, $time['day'], $time['year']); if ($time['error_count'] > 0) {
} else { $time = date_parse_from_format('Y-m-d', $datestamp);
}
if ($time['error_count'] > 0) {
return null; return null;
} else {
return gmmktime($time['hour'], $time['minute'], $time['second'], $time['month'] + 1, $time['day'], $time['year']);
} }
} }