diff --git a/NEWS b/NEWS index c1b688a4..168c1851 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + - fix allow empty years, months and days in html_select_date's + time-attribute (messju) - fix YES and NO should not be booleanized inside triple-quotes in a config-file (messju) - fix accidently slurped line following a triple-quoted value in a diff --git a/libs/plugins/function.html_select_date.php b/libs/plugins/function.html_select_date.php index 7a4ebf3e..ac4f2a14 100644 --- a/libs/plugins/function.html_select_date.php +++ b/libs/plugins/function.html_select_date.php @@ -123,7 +123,7 @@ function smarty_function_html_select_date($params, &$smarty) } // If $time is not in format yyyy-mm-dd - if (!preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $time) && $time!='--') { + if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) { // then $time is empty or unix timestamp or mysql timestamp // using smarty_make_timestamp to get an unix timestamp and // strftime to make yyyy-mm-dd @@ -160,8 +160,8 @@ function smarty_function_html_select_date($params, &$smarty) $month_values[''] = ''; } for ($i = 1; $i <= 12; $i++) { - $month_names[] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000)); - $month_values[] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000)); + $month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000)); + $month_values[$i] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000)); } $month_result .= '