From b0d8461bee7238b3eb1fae970edd4015cd4c9336 Mon Sep 17 00:00:00 2001 From: kink Date: Sun, 21 Nov 2004 11:35:33 +0000 Subject: [PATCH] Fix two time zone calculation bugs, thanks to david white for the excellent analysis; verified by me to be correct solutions. Closes: #1063879 git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8386 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + functions/date.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35230e8f..c489bc4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -155,6 +155,7 @@ Version 1.5.1 -- CVS - LDAP backend will use internal squirrelmail charset conversion functions instead of php xml extension. Fixes bug #655137. - Added Wood theme and Silver Steel theme by Pavel Spatny and Simple Green theme + - Fix two time zone calculation bugs, thanks to David White Version 1.5.0 -------------------- diff --git a/functions/date.php b/functions/date.php index 8b8d49c6..65db2003 100644 --- a/functions/date.php +++ b/functions/date.php @@ -349,8 +349,16 @@ function getDateString( $stamp ) { if ($invert_time) { $dateZ = - $dateZ; } + + // calculate when it was midnight and when it will be, + // in order to display dates differently if they're 'today' $midnight = $now - ($now % 86400) - $dateZ; - $nextmid = $midnight + 86400 - $dateZ; + // this is to correct if after calculations midnight is more than + // one whole day away. + if ($now - $midnight > 86400) { + $midnight += 86400; + } + $nextmid = $midnight + 86400; if (($show_full_date == 1) || ($nextmid < $stamp)) { $date_format = _("M j, Y"); @@ -447,4 +455,4 @@ function getTimeStamp($dateParts) { return ($mtime); } */ -?> \ No newline at end of file +?> -- 2.25.1