diff --git a/common.php b/common.php index 90c0a0fe696..3d1fe0382cf 100644 --- a/common.php +++ b/common.php @@ -3546,7 +3546,7 @@ function questionAttributes($returnByName=false) $qattributes["dropdown_dates_year_min"]=array( "types"=>"D", 'category'=>$clang->gT('Display'), - 'sortorder'=>100, + 'sortorder'=>110, 'inputtype'=>'text', "help"=>$clang->gT('Minimum year value in calendar'), "caption"=>$clang->gT('Minimum year')); @@ -3554,7 +3554,7 @@ function questionAttributes($returnByName=false) $qattributes["dropdown_dates_year_max"]=array( "types"=>"D", 'category'=>$clang->gT('Display'), - 'sortorder'=>100, + 'sortorder'=>111, 'inputtype'=>'text', "help"=>$clang->gT('Maximum year value for calendar'), "caption"=>$clang->gT('Maximum year')); diff --git a/qanda.php b/qanda.php index d7a6dd7512d..c3a7db6f395 100644 --- a/qanda.php +++ b/qanda.php @@ -1640,7 +1640,18 @@ function do_date($ia) $yearmax = 2020; } - for ($i=$yearmax; $i>=$yearmin; $i--) { + if ($yearmin > $yearmax) + { + $step = 1; + $reverse = true; + } + else + { + $step = -1; + $reverse = false; + } + + for ($i=$yearmax; ($reverse? $i<=$yearmin: $i>=$yearmin); $i+=$step) { if ($i == $currentyear) { $i_date_selected = SELECTED;