View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
20017Bug reportsSurvey takingpublic2025-05-06 11:54
Reportersamarta Assigned Totibor.pacalat  
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
Product Version6.6.x 
Summary20017: Error selecting the first possible date in the calendar
Description

This error occurs when, in a question of the date type, a relative minimum value is set for the date to be entered.
For example: ‘+6days’
When answering the questionnaire, if we choose the first day that can be selected, when we submit the questionnaire a popup window appears with the error:

"One or more questions have not been answered in a valid manner. You cannot proceed until these answers are valid."

Steps To Reproduce

1 - make a survey with one question of type date/time

2 - Insert "+6days" on Minimum date configuration of the question Display section

3- Answer the survey and choose the first available date of the calendar

Expected result

Submission successful

Actual result

popup window appears with the error:

"One or more questions have not been answered in a valid manner. You cannot proceed until these answers are valid."

(Write here what happened instead)

TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)LimeSurvey Community Edition Version 6.12.0+250310
I will donate to the project if issue is resolvedNo
BrowserSafari, Chrome
Database type & versionmysqlnd 7.4.21
Server OS (if known)
Webserver software & version (if known)Apache/2.4.37 (centos)
PHP Version7.4.21

Users monitoring this issue

There are no users monitoring this issue.

Activities

gabrieljenik

gabrieljenik

2025-04-23 22:59

manager   ~82474

If the input format does not include a time, the minimum date should either not include a time or be 00:00.

If this does not occur, and the minimum date has a time (Ex: 2025-04-29 15:30):

  • The date selected by the date picker will be 00:00 (Ex: 2025-04-29 00:00).
  • The minimum date will have a later time (Ex: 2025-04-29 15:30).
    Due to the implementation of the date picker, it will allow 2025-04-29 to be selected, but validation will fail.

An expression in the minimum date, such as "+6 days," resolves to a date that has a time, such as 2025-04-29 15:30.

To solve this problem, a more complex expression must be used: date("Y-m-d", strtotime("+6 days")).

This doesn't happen with maximum date validation, since a date with a time of 00:00 will always be less than or equal to the date resulting from the "+6 days" expression.


I will include a comment in the code to help in case this kind of questions appear again in the future.

gabrieljenik

gabrieljenik

2025-04-23 23:01

manager   ~82475

The question is, should we validate to avoid this kind of situtations in the future? Worth it?
Ex: If the min date has a time, and the date picker don't, trim the min date, as to compare equals.

DenisChenu

DenisChenu

2025-04-24 08:02

developer   ~82478

@gabrieljenik

https://github.com/LimeSurvey/LimeSurvey/pulls

No PR : right ?

Ex: If the min date has a time, and the date picker don't, trim the min date, as to compare equals.

I like this : something lime date(attribute['dateformat'], attribute['mindate']) and same with maxdate.

If it work : it's cool

DenisChenu

DenisChenu

2025-04-25 09:25

developer   ~82488

Unclear on your question here ?
Do not fix, but add information on help ?

gabrieljenik

gabrieljenik

2025-04-25 17:41

manager   ~82490

Fix:
https://github.com/LimeSurvey/LimeSurvey/commit/cdaee2d6b00bd9078fde18217c43274bf05314f5

Comment:
https://github.com/LimeSurvey/LimeSurvey/commit/62888264cac91ee5ceb4f9d414d902815bbbb80f

DenisChenu

DenisChenu

2025-04-26 11:25

developer   ~82492

Last edited: 2025-04-26 11:26

Oh,
You didn't create the PR ?

I put a comment : https://github.com/LimeSurvey/LimeSurvey/commit/cdaee2d6b00bd9078fde18217c43274bf05314f5#r155916500

Maybe we need to : create some min date + format question and check the desired behaviour.
(for example ;: I never use "now" but "today"

gabrieljenik

gabrieljenik

2025-04-29 15:02

manager   ~82532

https://github.com/LimeSurvey/LimeSurvey/pull/4252

DenisChenu

DenisChenu

2025-04-29 16:47

developer   ~82533

guest

guest

2025-04-30 14:50

viewer   ~82543

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=38799

LimeBot

LimeBot

2025-05-06 11:54

administrator   ~82582

Fixed in Release 6.13.2+250506

Related Changesets

LimeSurvey: master 14057a6e

2025-04-30 14:50

Gabriel Jenik

Committer: GitHub


Details Diff
Fixed issue 20017: Error selecting the first possible date in the calendar (04252)

Co-authored-by: lapiudevgit <devgit@lapiu.biz>
Affected Issues
20017
mod - application/helpers/expressions/em_manager_helper.php Diff File

Issue History

Date Modified Username Field Change
2025-03-18 12:47 samarta New Issue
2025-04-07 16:55 tibor.pacalat Assigned To => gabrieljenik
2025-04-07 16:55 tibor.pacalat Status new => assigned
2025-04-23 22:59 gabrieljenik Note Added: 82474
2025-04-23 22:59 gabrieljenik Bug heat 0 => 2
2025-04-23 22:59 gabrieljenik Assigned To gabrieljenik => DenisChenu
2025-04-23 22:59 gabrieljenik Status assigned => ready for code review
2025-04-23 23:01 gabrieljenik Note Added: 82475
2025-04-24 08:02 DenisChenu Note Added: 82478
2025-04-24 08:02 DenisChenu Bug heat 2 => 4
2025-04-25 09:25 DenisChenu Assigned To DenisChenu => gabrieljenik
2025-04-25 09:25 DenisChenu Status ready for code review => feedback
2025-04-25 09:25 DenisChenu Note Added: 82488
2025-04-25 17:41 gabrieljenik Note Added: 82490
2025-04-26 11:25 DenisChenu Note Added: 82492
2025-04-26 11:26 DenisChenu Note Edited: 82492
2025-04-29 15:02 gabrieljenik Assigned To gabrieljenik => DenisChenu
2025-04-29 15:02 gabrieljenik Status feedback => ready for code review
2025-04-29 15:02 gabrieljenik Note Added: 82532
2025-04-29 16:47 DenisChenu Assigned To DenisChenu => tibor.pacalat
2025-04-29 16:47 DenisChenu Status ready for code review => ready for testing
2025-04-29 16:47 DenisChenu Note Added: 82533
2025-04-30 14:50 Changeset attached => LimeSurvey master 14057a6e
2025-04-30 14:50 guest Note Added: 82543
2025-04-30 14:50 guest Bug heat 4 => 6
2025-04-30 14:50 tibor.pacalat Status ready for testing => resolved
2025-04-30 14:50 tibor.pacalat Resolution open => fixed
2025-05-06 11:54 LimeBot Note Added: 82582
2025-05-06 11:54 LimeBot Status resolved => closed
2025-05-06 11:54 LimeBot Bug heat 6 => 8