Skip to content

Commit 812c881

Browse files
committed
Allow also negative offsets
1 parent 7008407 commit 812c881

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

webapp/src/Controller/Jury/ContestController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,15 +956,19 @@ private function checkTimezones(FormInterface $form): ?Response
956956
foreach (['Activate', 'Deactivate', 'Start', 'End', 'Freeze', 'Unfreeze'] as $timeString) {
957957
$tmpValue = $formData->{'get' . $timeString . 'timeString'}();
958958
if ($tmpValue !== '' && !is_null($tmpValue)) {
959+
// Check if absolute time
959960
if (preg_match("/\d{2}-\d{2}-\d{2}.*/", $tmpValue) === 1) {
960961
$chr = $tmpValue[10]; // The separator between date & time
961962
$fields = explode($chr, $tmpValue);
962963
// First field is the time, 2nd/3th might be timezone or offset
963964
$tmpValue = substr(str_replace($fields[0], '', $tmpValue), 1); // Also remove the separator
965+
// Case with a timezone
964966
if (str_contains($tmpValue, ' ')) {
965967
$fields = explode(' ', $tmpValue);
966968
} elseif (str_contains($tmpValue, '+')) {
967969
$fields = explode('+', $tmpValue);
970+
} elseif (str_contains($tmpValue, '-')) {
971+
$fields = explode('-', $tmpValue);
968972
} elseif (substr($tmpValue, -1) === 'Z') {
969973
$timeZones[] = 'UTC';
970974
continue;

0 commit comments

Comments
 (0)