mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
fixed $start_year when no value for the year in $time is given.
This commit is contained in:
@@ -152,13 +152,15 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
$start_year = strftime('%Y') - $match[2];
|
$start_year = strftime('%Y') - $match[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($start_year > $time[0] && !isset($params['start_year'])) {
|
if (strlen($time[0]) > 0) {
|
||||||
// force start year to include given date if not explicitly set
|
if ($start_year > $time[0] && !isset($params['start_year'])) {
|
||||||
$start_year = $time[0];
|
// force start year to include given date if not explicitly set
|
||||||
}
|
$start_year = $time[0];
|
||||||
if($end_year < $time[0] && !isset($params['end_year'])) {
|
}
|
||||||
// force end year to include given date if not explicitly set
|
if($end_year < $time[0] && !isset($params['end_year'])) {
|
||||||
$end_year = $time[0];
|
// force end year to include given date if not explicitly set
|
||||||
|
$end_year = $time[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$field_order = strtoupper($field_order);
|
$field_order = strtoupper($field_order);
|
||||||
@@ -256,6 +258,8 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
$years = range((int)$start_year, (int)$end_year);
|
$years = range((int)$start_year, (int)$end_year);
|
||||||
if ($reverse_years) {
|
if ($reverse_years) {
|
||||||
rsort($years, SORT_NUMERIC);
|
rsort($years, SORT_NUMERIC);
|
||||||
|
} else {
|
||||||
|
sort($years, SORT_NUMERIC);
|
||||||
}
|
}
|
||||||
$yearvals = $years;
|
$yearvals = $years;
|
||||||
if(isset($year_empty)) {
|
if(isset($year_empty)) {
|
||||||
|
Reference in New Issue
Block a user