View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 20859 | Bug reports | Survey participants (Tokens) | public | 2026-11-16 20:51 | 2026-11-16 21:35 |
| Reporter | francois-charles.hebert | Assigned To | c_schmitz | ||
| Priority | none | Severity | partial_block | ||
| Status | resolved | Resolution | fixed | ||
| Product Version | 7.9.x | ||||
| Summary | 20859: Participant "Valid from" / "Valid until" are saved and displayed without timezone conversion, but enforced in UTC | ||||
| Description | The "Valid from" and "Valid until" dates of a survey participant do not behave according to the timezone of my account. My administrator account is set to America/Toronto (UTC-5 at this time of year). When I enter a "Valid until" date in the participant form, the participant loses access to the survey 5 hours before the time I entered. In the same way, a participant can enter the survey 5 hours before the "Valid from" time. Example: at 14:38 local time, I set "Valid until" to 16:00 the same day. The participant form still shows 16:00, but the access code is immediately refused with "This invitation is not valid anymore." Looking at the database, the value is saved exactly as I typed it (16:00:00), with no conversion to UTC. The survey then seems to compare it to the current UTC time (19:38 in my example), so the date is treated as UTC when access is checked, but as local time when I enter it and when it is displayed. Other dates do not have this problem: the survey start and expiry dates are converted to my timezone, and the "sent", "remindersent" and "completed" columns are stored in UTC. The same raw value is shown in the participant list, in the CSV export, and in the {VALIDFROM} / {VALIDUNTIL} email placeholders, so participants can also receive an invitation showing a validity date that is not the one actually applied. I had a look at the code and the validity checks all use gmdate() (Token.php scopes "usable" / "editable", SurveyIndex.php, Tokens.php email(), token_helper.php emailTokens(), remotecontrol_handle.php), while the participant form in Tokens.php only reformats the date without converting it from the display timezone. | ||||
| Steps To Reproduce | Steps to reproduce
Variant for "Valid from": set "Valid from" to today at 12:00 (2 hours in the future in local time), leave "Valid until" empty, and open the survey with the access code. Expected resultThe participant can access the survey until 12:00 local time (17:00 UTC), as shown in the participant form. The value should be stored in UTC ("YYYY-MM-DD 17:00:00") and converted back to the display timezone in the form, the table, and the email placeholders. Variant: the survey should not be accessible before 12:00 local time. Actual resultThe survey is refused with "This invitation is not valid anymore.", although the form shows an expiry 2 hours in the future. The stored value "12:00:00" is compared to gmdate(), which returns 15:00. Variant: the survey is accessible immediately, 2 hours before the "Valid from" time shown in the form. In both cases the validity window is shifted by the UTC offset of the administrator's timezone (5 hours earlier for America/Toronto in winter, 4 in summer). (Write here what happened instead) | ||||
| Tags | No tags attached. | ||||
| Bug heat | 2 | ||||
| Complete LimeSurvey version number (& build) | 7.9.0 | ||||
| I will donate to the project if issue is resolved | No | ||||
| Browser | |||||
| Database type & version | mariadb 10.11.17 | ||||
| Server OS (if known) | |||||
| Webserver software & version (if known) | |||||
| PHP Version | 8.4 | ||||
| Git branch / Pull Request URL | |||||
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=41338 |
|
|
LimeSurvey: master 7a421d34 2026-11-16 21:34 Details Diff |
Fixed issue 20859: Survey participants could access the survey earlier or later than their "Valid from"/"Valid until" dates when the administrator used a timezone other than UTC Dev Validity dates are now converted from the admin's display timezone to UTC when saved, and back to the display timezone in the participant list and its filters, the participant forms and the {VALIDFROM}/{VALIDUNTIL} email placeholders Dev CSV import/export and RemoteControl keep using UTC, now mentioned in the import hint and the API docs Dev Bulk edit parsed the date with strtotime(), which read dd/mm/yyyy dates as mm/dd/yyyy Dev Existing validity dates are not migrated Dev An empty personal timezone setting ("use global") was treated as UTC instead of falling back to the global timezone in getUTCOfDate()/getDateOfUTC(), which also shifted survey start and expiry dates on saving |
Affected Issues 20859 |
|
| mod - application/controllers/admin/Tokens.php | Diff File | ||
| mod - application/core/LimeMailer.php | Diff File | ||
| mod - application/helpers/common_helper.php | Diff File | ||
| mod - application/helpers/remotecontrol/remotecontrol_handle.php | Diff File | ||
| mod - application/models/TokenDynamic.php | Diff File | ||
| mod - application/views/admin/token/csvupload.php | Diff File | ||
| mod - application/views/admin/token/dummytokenform.php | Diff File | ||
| mod - application/views/admin/token/tokenform.php | Diff File | ||
| add - tests/unit/helpers/AdminDisplayTimezoneTest.php | Diff File | ||
| add - tests/unit/models/TokenValidityTimezoneTest.php | Diff File | ||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-11-16 20:51 | francois-charles.hebert | New Issue | |
| 2026-11-16 21:30 | c_schmitz | Assigned To | => c_schmitz |
| 2026-11-16 21:30 | c_schmitz | Status | new => assigned |
| 2026-11-16 21:35 | c_schmitz | Changeset attached | => LimeSurvey master 7a421d34 |
| 2026-11-16 21:35 | c_schmitz | Note Added: 87294 | |
| 2026-11-16 21:35 | c_schmitz | Status | assigned => resolved |
| 2026-11-16 21:35 | c_schmitz | Resolution | open => fixed |
| 2026-11-16 21:35 | c_schmitz | Bug heat | 0 => 2 |