diff options
| author | spiderr <spiderr@bitweaver.org> | 2025-06-15 02:04:57 -0400 |
|---|---|---|
| committer | spiderr <spiderr@bitweaver.org> | 2025-06-15 02:04:57 -0400 |
| commit | 256ce00dde43987798e1ad234b6a8e8d50791d16 (patch) | |
| tree | d05a724e5b637d2837ce49e0de234b73241dbddb | |
| parent | 4765bc9852811b6ea42faf0310d4f5fb06deda80 (diff) | |
| download | themes-256ce00dde43987798e1ad234b6a8e8d50791d16.tar.gz themes-256ce00dde43987798e1ad234b6a8e8d50791d16.tar.bz2 themes-256ce00dde43987798e1ad234b6a8e8d50791d16.zip | |
fix strings without timezones using strtotime in cal_date_format
| -rw-r--r-- | smartyplugins/modifier.cal_date_format.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/smartyplugins/modifier.cal_date_format.php b/smartyplugins/modifier.cal_date_format.php index 851573e..228d193 100644 --- a/smartyplugins/modifier.cal_date_format.php +++ b/smartyplugins/modifier.cal_date_format.php @@ -24,16 +24,20 @@ $gBitSmarty->loadPlugin('smarty_shared_make_timestamp'); */ function smarty_modifier_cal_date_format($string, $format = "%b %e, %Y", $default_date=null, $tra_format=null) { - $mDate = new BitDate(0); - if ( $mDate->get_display_offset()) $format = preg_replace("/ ?%Z/","",$format); - else $format = preg_replace("/%Z/","UTC",$format); + $mDate = new BitDate(); + if ( $mDate->get_display_offset()) { + $format = preg_replace("/ ?%Z/","",$format); + } else { + $format = preg_replace("/%Z/","UTC",$format); + } - $disptime = $mDate->getTimestampFromISO($string); + $disptime = strtotime( $string ); // Let PHP handle all conversion, TZ or not... global $gBitSystem, $gBitLanguage; //$gBitLanguage->mLanguage= $gBitSystem->getConfig("language", "en"); if ($gBitSystem->getConfig("language", "en") != $gBitLanguage->mLanguage && $tra_format) { $format = $tra_format; } + return $mDate->strftime($format, $disptime, true); } |
