fixed $start_year when no value for the year in $time is given.

This commit is contained in:
messju
2004-09-24 14:37:02 +00:00
parent 7ab14ec02a
commit 508e177b53

View File

@@ -152,7 +152,8 @@ function smarty_function_html_select_date($params, &$smarty)
$start_year = strftime('%Y') - $match[2];
}
}
if($start_year > $time[0] && !isset($params['start_year'])) {
if (strlen($time[0]) > 0) {
if ($start_year > $time[0] && !isset($params['start_year'])) {
// force start year to include given date if not explicitly set
$start_year = $time[0];
}
@@ -160,6 +161,7 @@ function smarty_function_html_select_date($params, &$smarty)
// force end year to include given date if not explicitly set
$end_year = $time[0];
}
}
$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);
if ($reverse_years) {
rsort($years, SORT_NUMERIC);
} else {
sort($years, SORT_NUMERIC);
}
$yearvals = $years;
if(isset($year_empty)) {