Skip to content

Commit 2d24411

Browse files
committed
Allow for the Z shorthand for UTC
1 parent 64c0172 commit 2d24411

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

webapp/src/Validator/Constraints/TimeStringValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class TimeStringValidator extends ConstraintValidator
1111
public function validate(mixed $value, Constraint $constraint): void
1212
{
1313
$timezoneRegex = "[A-Za-z][A-Za-z0-9_\/+-]{1,35}"; # See: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
14-
$absoluteRegex = "\d\d\d\d-\d\d-\d\d( |T)\d\d:\d\d:\d\d(\.\d{1,6})? " . $timezoneRegex;
14+
$absoluteRegex = "\d\d\d\d-\d\d-\d\d( |T)\d\d:\d\d:\d\d(\.\d{1,6})?( " . $timezoneRegex . "|Z)";
1515
$relativeRegex = "\d+:\d\d(:\d\d(\.\d{1,6})?)?";
1616
if (!$constraint instanceof TimeString) {
1717
throw new UnexpectedTypeException($constraint, TimeString::class);

webapp/tests/Unit/Controller/Jury/ContestControllerTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ class ContestControllerTest extends JuryControllerTestCase
4949
'silverMedals' => '1',
5050
'bronzeMedals' => '1',
5151
'medalCategories' => ['0' => '2']],
52+
['shortname' => 'utc_Z',
53+
'name' => 'UTC (Z)',
54+
'activatetimeString' => '2021-07-17 16:08:00Z',
55+
'starttimeString' => '2021-07-17 16:09:00.0Z',
56+
'freezetimeString' => '2021-07-17 16:10:00.00Z',
57+
'endtimeString' => '2021-07-17 16:11:00.000Z',
58+
'unfreezetimeString' => '2021-07-17T16:12:00.1Z',
59+
'deactivatetimeString' => '2021-07-17T16:13:00.2Z'],
5260
['shortname' => 'otzcet',
5361
'name' => 'Other timezone (CET)',
5462
'activatetimeString' => '2021-07-17 16:08:00 CET',

0 commit comments

Comments
 (0)