Commit 13f4eaae by seldaek

Fixed date_format handling of negative and small unix timestamps

git-svn-id: svn://dwoo.org/dwoo/trunk@217 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent ac01ee14
[2008--] 1.0.1 [2008--] 1.0.1
* Fixed a {foreach} bug with the implode argument * Fixed a {foreach} bug with the implode argument
* Fixed modulo operator in if statements * Fixed modulo operator in if statements
* Fixed date_format handling of negative and small unix timestamps
[2008-10-23] 1.0.0 [2008-10-23] 1.0.0
! BC Break: Small one that probably won't affect anyone, but it makes the ! BC Break: Small one that probably won't affect anyone, but it makes the
......
...@@ -22,12 +22,12 @@ function Dwoo_Plugin_date_format(Dwoo $dwoo, $value, $format='%b %e, %Y', $defau ...@@ -22,12 +22,12 @@ function Dwoo_Plugin_date_format(Dwoo $dwoo, $value, $format='%b %e, %Y', $defau
{ {
if (!empty($value)) { if (!empty($value)) {
// convert if it's not a valid unix timestamp // convert if it's not a valid unix timestamp
if (preg_match('#^\d{10}$#', $value)===0) { if (preg_match('#^-?\d{1,10}$#', $value)===0) {
$value = strtotime($value); $value = strtotime($value);
} }
} elseif (!empty($default)) { } elseif (!empty($default)) {
// convert if it's not a valid unix timestamp // convert if it's not a valid unix timestamp
if (preg_match('#^\d{10}$#', $default)===0) { if (preg_match('#^-?\d{1,10}$#', $default)===0) {
$value = strtotime($default); $value = strtotime($default);
} else { } else {
$value = $default; $value = $default;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment