Skip to content

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

Description

@Balenty

Bug Report + Workaround
Issue with:
Datepicker in Forms

Symptom:
After creating a form that contains a datepicker with a specific end date, the users may have issues submitting the form when the selected date is precisely the end date. Resulting in the error feedback "Date/time is not in the allowed range for Question X"

Investigation:
My first idea was "that feels like a timezone issue".
When creating the form, the server received a Unix-Timestamp of the selected start/end date within the local system timezone.
When a user is opening the form, the server is sending this specific Unix-Timestamp to the user.
When a user is sending an answer, it sends a date-string, e.g. "24.08.2026" not a Unix timestamp.

Regular Users:
Regular users are from Europe (Germany) and mostly use GMT +2 Berlin summertime as their local timezone.

Workaround:
When the creator uses GMT -2 or lower on his local system, a regular user can submit the end-date without error.
When the creator uses GMT -1 or higher on his local system, a regular user cannot submit the end-date without error.

Assumption:
The server converts the user's date string to a Unix timestamp with the server's timezone and compares it with the start/end Unix timestamp of the form.

Can it be recreated?
Create your own form (have local timezone GMT +2 Berlin summertime active).
Add a Date.
Add an end-date limitation.
Test your form and submit the chosen end-date. (Test-Instance should be configured to GMT +0)

Configuration:
The (Docker-) Nextcloud instance runs on 33.0.5.1 with the Forms add-on.
Local instance timezone is set to GMT +0

Potential approach to fix this issue:
When a form with a datepicker and end date is created, don't save a Unix timestamp. Use a date string instead—just the same as what is sent when answering the form.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending approval or rejection. This issue is pending approval.bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions