allow single-digit days and months without smarty_make_timestamp()

this makes dates like "1968-11-6" work correctly since no strtotime()
is involved

add warning when unknown parameter is passed
This commit is contained in:
messju
2003-12-17 09:32:30 +00:00
parent 47626725f8
commit 331c2ef286
2 changed files with 7 additions and 1 deletions

2
NEWS
View File

@@ -1,3 +1,5 @@
- allow single-digit days and months without smarty_make_timestamp()
in html_select_date (messju)
- fix headers sent erroneously with cache_modified_check and fetch()
(wphilips, messju)
- fix config_file path bug (Marc Cabadas, Monte)

View File

@@ -115,11 +115,15 @@ function smarty_function_html_select_date($params, &$smarty)
case 'reverse_years':
$$_key = (bool)$_value;
break;
default:
$smarty->trigger_error("[html_select_time] unknown parameter $_key", E_USER_WARNING);
}
}
// If $time is not in format yyyy-mm-dd
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $time) && $time!='--') {
if (!preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $time) && $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