mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-31 20:31:41 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user