View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
10011 | Bug reports | Survey editing | public | 2015-11-02 18:28 | 2016-01-22 08:54 |
Reporter | akeyser | Assigned To | DenisChenu | ||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Product Version | 2.06+ | ||||
Fixed in Version | 2.06+ | ||||
Summary | 10011: Date/Time "Dropdown Boxes" functionality does not respect min/max date values set to a calculated date (such as "now") | ||||
Description | Date/Time "Dropdown Boxes" functionality does not respect min/max date values that are set to "now", but the alternative to "Dropdown Boxes" (the Date Picker) does. | ||||
Steps To Reproduce | Attached is a lss file that exposes the issue at hand. The first question clearly exposes this bug: With a Date/Time field set to use Dropdown Boxes, with a Maximum date set to "now", the Year component of the picker is not restricted to the current year. The second question uses the same Maximum Date ("now"), but instead uses the Date/Time picker. This configuration correctly limits the year picker to the current year, but for our purposes we do not wish to use the date/time picker (it has some bugs of its own). The third question uses the same configuration as the first, except the "now" Maximum Date is replaced with 2017. With this configuration, the drop down box for Year does respect the indicated maximum date. All of the above scenarios actually display the proper minimum/maximum constraints above the date pickers. | ||||
Additional Information | This also fails with other non-date strings that would normally be calculated by php "strtotime", like "-2 years", or "+7 weeks". To me, it seems like the code that generates the dropdown boxes for the Date/Time picker is not first running "strtotime" against the provided string, unlike the rest of the areas in which it is used, and thus it fails to generate correct dropdowns as a result. | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Bug heat | 8 | ||||
Complete LimeSurvey version number (& build) | 151018 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | Chrome 45+ (Mac) | ||||
Database type & version | MySQL 5.6 | ||||
Server OS (if known) | Windows | ||||
Webserver software & version (if known) | IIS 7 | ||||
PHP Version | 5.6.14 | ||||
related to | 09643 | closed | DenisChenu | Date/Time question with drop down values fails validation when only one value is selected and MySQL is not the database |
I don't think this is a bug. You are using the maximum date field in an unsupported way, so you are getting inconsistent results. The maximum date is sanitized for the dropdown presentation in such a way that it's defaulting the maximum date to the hardcoded maximum value of 2037-12-31. On the datepicker side, JQuery-ui-datepicker is being passed the string "now", which it also considers an invalid value. However, the default in the datepicker library is to use a new Date object (which defaults to the current time). So it only appears to be working properly there because you got lucky in that the library's defaults coincided with the behavior you desired. If anything this should be a new feature request to also allow "now" as the maximum value and handle this special case properly. Extending it further, it could parse the maximum value from strtotime as you suggest. However, this is not the current behavior at all. |
|
Hi, I think it's a bug (send a new lss file next). Example :
I think actually : testing if max is a number, but must evaluate if date_max is a number after Expression. Denis |
|
'now' is not a valid value by any means. |
|
After submitting this bug I actually discovered exactly what @zerwalter has stated. So yes, I would agree that this is in fact a feature request, as any "hack" that uses "date" or "strtotime" probably wouldn't be executed in a way that works for both types of dropdown implementations. Prior to reporting, was just playing around with the application and discovered that the functionality "just worked" if "now" was entered while using the JQUI DatePicker. I see now that the actual bug is more like "the JQUI datepicker min/max date is not set to hardcoded minimum and maximum defaults if an invalid date is specified" |
|
@Cartsen : i send a lss file when i have time :). strtotime("now") is valid http://php.net/manual/fr/function.strtotime.php Tested too with {date("Y",strtotime("now"))} give 2015 in question text. It work in javascripot, just don't set in dropdown. We must validate if it's a valid date after EM and not before EM. |
|
Anyway, we can't just process the expression in PHP because this would make it static and we would lose function. |
|
No : EM don't return Statix if we don't force it : The questionNum use the step : and return Static only if we don't have variable in same step. For example : |
|
Right, but if we consider this a buggy behaviour we should fix it completely - and the complete fix would be that it also can be handled dynamically. |
|
Fix it if EM return a fixed string : easy |
|
ok, can you do the easy part? |
|
I go PHP part first. Think dropdown system can be really broken here. Example :
At start (if MAXYEAR is in same group) : show 2037 for max year.
It's a silly situation but ;) |
|
There are nother issue. Min : date("Y",strtotime("-1 year")) : result :2014 But : show "answer MUST BE 11/12/2015 (and select ctual day don't work). |
|
Thinking: Can break in JS. |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=16545 |
|
Fixed : leave open for manual update |
|
LimeSurvey: master c3ceac2c 2015-12-15 19:33 Details Diff |
Fixed issue 10011: Date/Time "Dropdown Boxes" functionality does not respect min/max date values set to a calculated date Dev: work only with 'fixed' date : JS update of dropdown need more javascript (and EM event) Dev: must update manual .... |
Affected Issues 10011 |
|
mod - application/helpers/qanda_helper.php | Diff File | ||
LimeSurvey: master 9a09b699 2015-12-15 20:20 Details Diff |
Dev: remove some debug ... |
Affected Issues 10011 |
|
mod - application/helpers/qanda_helper.php | Diff File | ||
LimeSurvey: master 44c2ff32 2015-12-17 11:58 Details Diff |
Dev: 10011 : more detailed help Dev: don't take EM is it's already a date (format YYYY-MM-DD) |
Affected Issues 10011 |
|
mod - application/helpers/common_helper.php | Diff File | ||
mod - application/helpers/qanda_helper.php | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-11-02 18:28 | akeyser | New Issue | |
2015-11-02 18:28 | akeyser | File Added: limesurvey_survey_611927.lss | |
2015-12-10 02:08 | mfavetti | Note Added: 33835 | |
2015-12-10 09:33 | DenisChenu | Note Added: 33839 | |
2015-12-10 16:38 | c_schmitz | Note Added: 33867 | |
2015-12-10 16:38 | c_schmitz | Note Edited: 33867 | |
2015-12-10 16:40 | akeyser | Note Added: 33868 | |
2015-12-10 16:42 | DenisChenu | Note Added: 33869 | |
2015-12-10 16:44 | akeyser | Note Edited: 33868 | |
2015-12-10 16:55 | c_schmitz | Note Added: 33870 | |
2015-12-10 17:05 | DenisChenu | Note Added: 33872 | |
2015-12-10 17:05 | DenisChenu | Note Edited: 33872 | |
2015-12-10 17:06 | DenisChenu | Note Edited: 33872 | |
2015-12-10 17:06 | DenisChenu | Note Edited: 33872 | |
2015-12-10 19:10 | c_schmitz | Note Added: 33874 | |
2015-12-10 19:11 | c_schmitz | Note Edited: 33874 | |
2015-12-10 19:11 | c_schmitz | Note Edited: 33874 | |
2015-12-10 19:15 | c_schmitz | Note Edited: 33874 | |
2015-12-10 19:30 | DenisChenu | Note Added: 33876 | |
2015-12-10 19:34 | c_schmitz | Note Added: 33877 | |
2015-12-11 12:37 | DenisChenu | Assigned To | => DenisChenu |
2015-12-11 12:37 | DenisChenu | Status | new => assigned |
2015-12-11 12:39 | DenisChenu | Note Added: 33888 | |
2015-12-11 12:40 | DenisChenu | Note Edited: 33888 | |
2015-12-11 19:33 | DenisChenu | Note Added: 33897 | |
2015-12-11 19:34 | DenisChenu | File Added: limesurvey_survey_dateexemplemore.lss | |
2015-12-11 19:34 | DenisChenu | Relationship added | related to 09643 |
2015-12-13 17:15 | DenisChenu | Note Added: 33904 | |
2015-12-15 19:33 | DenisChenu | Changeset attached | => LimeSurvey master c3ceac2c |
2015-12-15 19:33 | DenisChenu | Note Added: 33983 | |
2015-12-15 19:33 | DenisChenu | Resolution | open => fixed |
2015-12-16 08:11 | DenisChenu | Changeset attached | => LimeSurvey master 9a09b699 |
2015-12-16 11:13 | DenisChenu | Note Added: 34001 | |
2015-12-17 12:19 | DenisChenu | Changeset attached | => LimeSurvey master 44c2ff32 |
2015-12-17 12:19 | DenisChenu | Status | assigned => resolved |
2015-12-17 12:19 | DenisChenu | Fixed in Version | => 2.06+ |
2016-01-22 08:54 | c_schmitz | Status | resolved => closed |
2019-11-01 17:25 | c_schmitz | Category | Survey design => Survey editing |