mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
fix date_format modifier, return nothing if given empty string
This commit is contained in:
@@ -11,7 +11,11 @@
|
|||||||
require_once SMARTY_DIR . $this->plugins_dir . '/shared.make_timestamp.php';
|
require_once SMARTY_DIR . $this->plugins_dir . '/shared.make_timestamp.php';
|
||||||
function smarty_modifier_date_format($string, $format="%b %e, %Y")
|
function smarty_modifier_date_format($string, $format="%b %e, %Y")
|
||||||
{
|
{
|
||||||
return strftime($format, smarty_make_timestamp($string));
|
if($string != '') {
|
||||||
|
return strftime($format, smarty_make_timestamp($string));
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set expandtab: */
|
/* vim: set expandtab: */
|
||||||
|
@@ -11,7 +11,11 @@
|
|||||||
require_once SMARTY_DIR . $this->plugins_dir . '/shared.make_timestamp.php';
|
require_once SMARTY_DIR . $this->plugins_dir . '/shared.make_timestamp.php';
|
||||||
function smarty_modifier_date_format($string, $format="%b %e, %Y")
|
function smarty_modifier_date_format($string, $format="%b %e, %Y")
|
||||||
{
|
{
|
||||||
return strftime($format, smarty_make_timestamp($string));
|
if($string != '') {
|
||||||
|
return strftime($format, smarty_make_timestamp($string));
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set expandtab: */
|
/* vim: set expandtab: */
|
||||||
|
Reference in New Issue
Block a user