From d89d45ea08ff1c7940eac1b4e2d8e5d1287097d0 Mon Sep 17 00:00:00 2001 From: PPetky Date: Wed, 20 Nov 2024 22:29:19 +0100 Subject: [PATCH] dst in send_reminder --- tools/send_reminders.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/send_reminders.php b/tools/send_reminders.php index 49ecd8433..924ca0531 100755 --- a/tools/send_reminders.php +++ b/tools/send_reminders.php @@ -528,6 +528,8 @@ function process_event ( $id, $name, $start, $end, $new_date = '' ) { // Get reminders array. $reminder = getReminders ( $id ); + // Is Daylight saving time (DST) on server + $dst = date("I"); if ( ! empty ( $reminder ) ) { if ( $debug ) @@ -547,6 +549,10 @@ function process_event ( $id, $name, $start, $end, $new_date = '' ) { $times_sent = 0; } $new_offset = date_to_epoch ( $new_date ) - ( $start - ( $start % 86400 ) ); + // Add one hour if the date stuck with dst set + $new_offset += ((date ('m', $start) * 1)>=3 && (date ('m', $start) * 1) < 11 && !$dst) * 60 * 60; + // Substract one hour if the date stuck with dst not set + $new_offset -= ((date ('m', $start) * 1)>=11 && (date ('m', $start) * 1) < 3 && $dst) * 60 * 60; $start += $new_offset; $end += $new_offset; }