[Hastymail-devel] mail list date bug
Brought to you by:
sailfrog,
slushpupie
From: Thierry de M. <th...@if...> - 2010-09-14 18:17:02
|
Hi, Not sure this is the right place to send fixes, please confirm. Here's a patch to fix a date problem in the mail list when the timezone is 'UT', which happens in quite a lot of mails. I saw that there was a fix for that in the build_time_diff() function, so I moved it to the print_time2() function, which does call the former, so that even if you don't use the 'From now' format, you get proper date display with 'UT' timezone. Please see the patch below, tested and working on our site. Regards, ________________________________ Thierry de Montaudry Interface Holding (Pty) Ltd +27 (0)82 812 6622 +27 (0)11 628 9800 ======== BEGIN CODE ======== --- lib/misc_functions.php.org 2010-09-06 13:51:16.000000000 +0200 +++ lib/misc_functions.php 2010-09-14 19:45:26.000000000 +0200 @@ -281,15 +281,19 @@ function trim_htmlstr($string, $len) { function print_time2($date_string, $date_format, $date_format_2) { global $user; $data = ''; + $date_string = trim($date_string); + if (preg_match("/UT$/", $date_string)) { + $date_string .= 'C'; + } if (!$date_format) { - $data .= '<span title="'.$user->htmlsafe(trim($date_string)).'">'; + $data .= '<span title="'.$user->htmlsafe($date_string).'">'; $data .= print_time(strtotime($user->htmlsafe($date_string)), $date_string).'</span>'; } else { $data .= '<span title="'.print_time(strtotime($user->htmlsafe($date_string)), $date_string).'">'; - $data .= $user->htmlsafe(date($date_format, strtotime(trim($date_string)))); + $data .= $user->htmlsafe(date($date_format, strtotime($date_string))); if ($date_format_2) { - $data .= ' '.$user->htmlsafe(date($date_format_2, strtotime(trim($date_string)))); + $data .= ' '.$user->htmlsafe(date($date_format_2, strtotime($date_string))); } $data .= '</span>'; } @@ -297,9 +301,7 @@ function print_time2($date_string, $date } function build_time_diff($timestamp, $date_str=false) { if (!$timestamp) { - if (preg_match("/UT$/", trim($date_str))) { - $timestamp = strtotime(substr(trim($date_str), 0, -3).' GMT'); - } + $timestamp = strtotime($date_str); if (!$timestamp) { return 'unknown'; } ======== END CODE ======== |