Skip to content

Verify that timestrings can be parsed #3051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2025

Conversation

vmcj
Copy link
Member

@vmcj vmcj commented Aug 6, 2025

In case of "unknown" timezones we would silently set the starttime to 0 but leave the startTimeString so the user would not be aware that the starttime is set to a completely different value.

@vmcj vmcj force-pushed the unknown_timezone_starttime branch from 0d6e799 to 1c2cb4f Compare August 6, 2025 17:36
if (preg_match("/^[+-]?\d+:\d\d(:\d\d(\.\d{1,6})?)?$/", $timeString) !== 1) {
try {
$date = new DateTime($timeString);
} catch (Exception) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the exception here tell us what's wrong? If so, can we extract it (or get it from somewhere else) and return it to the user?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Ugly message but more info yes.

@vmcj vmcj force-pushed the unknown_timezone_starttime branch from 8130426 to 7c0f515 Compare August 6, 2025 18:02
@vmcj vmcj requested a review from meisterT August 6, 2025 18:13
@vmcj vmcj force-pushed the unknown_timezone_starttime branch from 47b7786 to f2110f0 Compare August 6, 2025 18:49
In case of "unknown" timezones we would silently set the starttime to 0
but leave the startTimeString so the user would not be aware that the
starttime is set to a completely different value.
@vmcj vmcj force-pushed the unknown_timezone_starttime branch from f2110f0 to b90a235 Compare August 6, 2025 19:24
@vmcj vmcj enabled auto-merge August 6, 2025 19:25
@vmcj vmcj added this pull request to the merge queue Aug 6, 2025
Merged via the queue into DOMjudge:main with commit 65af5fe Aug 6, 2025
36 checks passed
@vmcj vmcj deleted the unknown_timezone_starttime branch August 6, 2025 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants