View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
09591 | Bug reports | Survey taking | public | 2015-03-27 18:55 | 2015-06-20 12:16 |
Reporter | gabrieljenik | Assigned To | mfaber | ||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | no change required | ||
Product Version | 2.05+ | ||||
Summary | 09591: Sometimes date_max / date_min validations for date/time questions doesn't allow to use the maximum date expected | ||||
Description | When using date_max / date_min validations for date/time questions, validation doesn't allow to use as pinut the "max date" expected. Question settings: Question attached. | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Bug heat | 8 | ||||
Complete LimeSurvey version number (& build) | 150310 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | MySQL | ||||
Server OS (if known) | Linux | ||||
Webserver software & version (if known) | Apache | ||||
PHP Version | 5.5 | ||||
It works using date("Y-m-d H:i") instead of date("Y-m-d"). The comparison fails at the moment because I also corrected a mistake in the wiki concerning date_max |
|
Added some code to enhance comparison and avoid errors like I got. PR: https://github.com/LimeSurvey/LimeSurvey/pull/298 |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=15062 |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=15063 |
|
PR for v2.06: https://github.com/LimeSurvey/LimeSurvey/pull/299 |
|
Fix committed to 2.06 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=15065 |
|
The change breaks usage of certain EM conditions for min/max values. For example it was previously possible to use Maximum date: date('Y-m-d')+1 Now this condition does not validate properly. |
|
I do not know what LS produced with "date('Y-m-d')+1", but it is not a valid expression. Date() produces a string in the given format and "+1" likely adds a "1" to the string. A correct expression to allow for dates up to tomorrow would be: date("Y-m-d H:i", strtotime("now")+606024). But maybe there are other ways. |
|
You are right - sorry, can be closed again. |
|
I am reopening this to make some comments about previous notes. When adding a date question, date_min and date_max are attributes that are said to handle expressions, as << date('Y-m-d') + 1 >>. As now, inside the code, those expression are taken as a parameter by strtotime, and I guess that generates an error. So my guess the issue is valid... what do you think? PS: The expression to allow dates up to tomorrow could also be << date("Y-m-d H:i", strtotime("tomorrow")) >>. That put into an LS question configuration (after this issue is solved) could be something like date_max: << strtotime("tomorrow") >> |
|
Gabrieljenik: The error comes because date('Y-m-d') + 1 is not a valid expression because it would be like adding "1" to the string "2015-04-22". The expression "date("Y-m-d H:i", strtotime("now")+606024)" works well. Entering strtotime("tomorrow") will not work for two reasons: 2) In the datemin/max field you need to enter a valid dateSTRING such as "2015-04-22" or "22.04.2015" or an expression that will produce such a string. Strtotime will produce the number of seconds since 1970, so this needs further conversion via function date(). |
|
Sorry, you are right. |
|
LimeSurvey: master 4b7f15e4 2015-03-31 20:27 Details Diff |
Fixed issue 09591: Sometimes date_max / date_min validations for date/time questions doesn't allow to use the maximum date expected. - Reformat expression held into date_max / date_min into "Y-m-d H:i" format, so comparison can be done among equals format. |
Affected Issues 09591 |
|
mod - application/helpers/expressions/em_manager_helper.php | Diff File | ||
LimeSurvey: master 202f68f4 2015-03-31 23:01 Committer: mfaber Details Diff |
Merge pull request #298 from gabrieljenik/patch-11 Fixed issue 09591: Sometimes date_max / date_min validations for date/t... |
Affected Issues 09591 |
|
mod - application/helpers/expressions/em_manager_helper.php | Diff File | ||
LimeSurvey: 2.06 2d6849a8 2015-03-31 23:21 Details Diff |
Fixed issue 09591: Sometimes date_max / date_min validations for date/time questions doesn't allow to use the maximum date expected. - Reformat expression held into date_max / date_min into "Y-m-d H:i" format, so comparison can be done among equals format. - Now min_date / max_date supports all the date formats correctly parsed by strtotime: YYYY-MM-DD, YYYY/MM/DD, DD.MM.YYYY, MM/DD/YYYY, DD-MM-YYYY, US natural language, ... |
Affected Issues 09591 |
|
mod - application/helpers/expressions/em_manager_helper.php | Diff File | ||
LimeSurvey: 2.06 229abfd5 2015-03-31 23:36 Committer: mfaber Details Diff |
Merge pull request #299 from gabrieljenik/patch-12 Fixed issue 09591: Sometimes date_max / date_min validations for date/ti... |
Affected Issues 09591 |
|
mod - application/helpers/expressions/em_manager_helper.php | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-03-27 18:55 | gabrieljenik | New Issue | |
2015-03-27 18:55 | gabrieljenik | Status | new => assigned |
2015-03-27 18:55 | gabrieljenik | Assigned To | => gabrieljenik |
2015-03-27 18:55 | gabrieljenik | File Added: limesurvey_question_3594.lsq | |
2015-03-27 20:30 | mfaber | Note Added: 31922 | |
2015-03-27 21:24 | mfaber | Note Edited: 31922 | |
2015-03-27 21:29 | mfaber | Issue Monitored: mfaber | |
2015-03-31 20:29 | gabrieljenik | Note Added: 31931 | |
2015-03-31 20:30 | gabrieljenik | Status | assigned => resolved |
2015-03-31 20:30 | gabrieljenik | Resolution | open => fixed |
2015-03-31 23:02 | gabrieljenik | Changeset attached | => LimeSurvey master 4b7f15e4 |
2015-03-31 23:02 | mfaber | Changeset attached | => LimeSurvey master 202f68f4 |
2015-03-31 23:02 | gabrieljenik | Note Added: 31932 | |
2015-03-31 23:02 | mfaber | Note Added: 31933 | |
2015-03-31 23:02 | mfaber | Assigned To | gabrieljenik => mfaber |
2015-03-31 23:22 | gabrieljenik | Note Added: 31934 | |
2015-03-31 23:36 | gabrieljenik | Changeset attached | => LimeSurvey 2.06 2d6849a8 |
2015-03-31 23:36 | mfaber | Changeset attached | => LimeSurvey 2.06 229abfd5 |
2015-03-31 23:36 | mfaber | Note Added: 31935 | |
2015-04-21 10:51 | c_schmitz | Note Added: 32025 | |
2015-04-21 10:51 | c_schmitz | Status | resolved => feedback |
2015-04-21 10:51 | c_schmitz | Resolution | fixed => reopened |
2015-04-21 13:13 | mfaber | Note Added: 32029 | |
2015-04-21 14:10 | c_schmitz | Note Added: 32030 | |
2015-04-21 14:10 | c_schmitz | Status | feedback => closed |
2015-04-21 14:10 | c_schmitz | Resolution | reopened => fixed |
2015-04-21 19:08 | gabrieljenik | Note Added: 32032 | |
2015-04-21 19:08 | gabrieljenik | Status | closed => feedback |
2015-04-21 19:08 | gabrieljenik | Resolution | fixed => reopened |
2015-04-22 15:16 | mfaber | Note Added: 32037 | |
2015-04-22 15:53 | gabrieljenik | Note Added: 32038 | |
2015-04-22 15:53 | gabrieljenik | Status | feedback => assigned |
2015-04-22 16:07 | mfaber | Status | assigned => resolved |
2015-04-22 16:07 | mfaber | Resolution | reopened => no change required |
2015-04-22 16:07 | mfaber | Status | resolved => closed |
2015-06-20 12:16 | mfaber | Relationship added | related to 09701 |
2021-08-02 17:19 | guest | Bug heat | 6 => 8 |