mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
make time param work with negative timestamps, force year range to include
given date unless explicitly set
This commit is contained in:
3
NEWS
3
NEWS
@@ -1,3 +1,6 @@
|
|||||||
|
- make html_select_date work with negative timestamps, also
|
||||||
|
force year range to include given date unless explicitly
|
||||||
|
set (Garo, Monte)
|
||||||
- fix bug with fetch, passing user/pass in url did not work
|
- fix bug with fetch, passing user/pass in url did not work
|
||||||
(Monte)
|
(Monte)
|
||||||
- fix occasional wrong error messages on mismatched tags when
|
- fix occasional wrong error messages on mismatched tags when
|
||||||
|
@@ -122,6 +122,10 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(preg_match('!^-\d+$!',$time)) {
|
||||||
|
// negative timestamp, use date()
|
||||||
|
$time = date('Y-m-d',$time);
|
||||||
|
}
|
||||||
// If $time is not in format yyyy-mm-dd
|
// If $time is not in format yyyy-mm-dd
|
||||||
if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) {
|
if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) {
|
||||||
// then $time is empty or unix timestamp or mysql timestamp
|
// then $time is empty or unix timestamp or mysql timestamp
|
||||||
@@ -147,6 +151,14 @@ 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'])) {
|
||||||
|
// 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
|
||||||
|
$end_year = $time[0];
|
||||||
|
}
|
||||||
|
|
||||||
$field_order = strtoupper($field_order);
|
$field_order = strtoupper($field_order);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user