[Tiki-devel] Sorry, timezones again

Jonny Bradley via TikiWiki-devel <[email protected]>
Newsgroups gmane.comp.cms.tiki.devel
Message-ID <[email protected]>
Hi all, mostly Victor i think, but for general discussion...

I have another couple of issues with timezones in calendars, quite easily reproducible here for me... i'm in GMT Europe/London zone, and my php says default timezone is UTC and the tiki is set to London and "automatically detected time zone" which also is Europe/London.

If i create a calendar event for after 27th March (when our clocks go forward to British Summer Time/BST) at 12:00 noon, it shows as being 13:00, so definitely incorrect. If i apply the patch below open \TikiLib::date_format, which combines creating the "tikidate" and setting the timezone at the same time, it all looks ok... so should i commit that? This function is used 220 times in tiki at least, and timezones scare me!

A side effect of this is that i have a recurring weekly noon event that starts in GMT but continues into "summer time" and with this patch the BST ones show as being at 11:00, so they would need correcting, because they looked ok before...

I know i'm out of my depth here, so would like some reassurance or pointers in the right direction please :)

TIA

jonny
---



Index: lib/tikilib.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/tikilib.php b/lib/tikilib.php
--- a/lib/tikilib.php	(revision 632dbe0774db70d405de13f743c0fe35a697dd9d)
+++ b/lib/tikilib.php	(date 1647603391982)
@@ -5672,19 +5672,13 @@
         }
 
         $tikidate = TikiLib::lib('tikidate');
+        $tz = $tikilib->get_display_timezone($_user);
         try {
-            $tikidate->setDate($timestamp, 'UTC');
+            $tikidate->setDate($timestamp, $tz);
         } catch (Exception $e) {
             return $e->getMessage();
         }
 
-        $tz = $tikilib->get_display_timezone($_user);
-
-        // If user timezone is not also in UTC, convert the date
-        if ($tz != 'UTC') {
-            $tikidate->setTZbyID($tz);
-        }
-
         $return = $tikidate->format($format, $is_strftime_format);
         if ($is_strftime_format) {
             $currentUserDateByFormat[ $format . $timestamp ] = $return;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.