Skip to content

fix: update dateMin and dateMax to accept string or integer formats and enhance validation logic - #3659

Open
Chartman123 wants to merge 3 commits into
mainfrom
fix/date-limits
Open

fix: update dateMin and dateMax to accept string or integer formats and enhance validation logic#3659
Chartman123 wants to merge 3 commits into
mainfrom
fix/date-limits

Conversation

@Chartman123

Copy link
Copy Markdown
Collaborator

Fixes #3617 by making the validation of date limits timezone-independent

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@Chartman123 Chartman123 added bug Something isn't working 3. to review Waiting for reviews feature: 📝 submitting responses labels Sep 13, 2026
@Chartman123 Chartman123 self-assigned this Sep 13, 2026
@codecov

codecov Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.55556% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/Service/FormsService.php 90.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

…nd enhance validation logic

Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
@Chartman123
Chartman123 marked this pull request as ready for review September 13, 2026 21:39
Comment thread lib/Service/SubmissionService.php Outdated
Comment thread lib/Service/SubmissionService.php Outdated
Comment thread lib/Service/SubmissionService.php Outdated
Comment thread lib/Service/FormsService.php Outdated
Comment thread lib/Service/FormsService.php Outdated
Comment thread lib/Service/SubmissionService.php Outdated
|| (isset($extraSettings['timeMax']) && $d > DateTime::createFromFormat($format, $extraSettings['timeMax']))
$dateMin = isset($extraSettings['dateMin'])
? (is_int($extraSettings['dateMin'])
? (new DateTime())->setTimestamp($extraSettings['dateMin'])->setTime(0, 0, 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

*** can be fixed in the future but quick mention:
old timestamp limits can still pick the wrong calendar day because of timezone (server vs browser). when reading legacy int, turn it into a 'Y-m-d' string first and then use the same string comparison path as the new limits instead of 'setTimestamp()->setTime(0, 0, 0)', something like:


$dateMin = (new \DateTime('@' . $extraSettings['dateMin']))
	->setTimezone(new \DateTimeZone('UTC'))
	->format('Y-m-d');
$dateMin = \DateTime::createFromFormat('!Y-m-d', $dateMin);

Comment thread lib/Service/SubmissionService.php Outdated
: null;
$dateMax = isset($extraSettings['dateMax'])
? (is_int($extraSettings['dateMax'])
? (new DateTime())->setTimestamp($extraSettings['dateMax'])->setTime(0, 0, 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same here as ***

…rmats and enhance validation logic

Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
…eger formats and enhance validation logic

Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug Something isn't working feature: 📝 submitting responses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Start-/End-Limited Datepickers validation incorrect due to timezone

2 participants