Browse Source

Merge pull request #25174 from AmazingBeu/develop

[Agenda] change date time zone for full day event
Laurent Destailleur 2 years ago
parent
commit
e19e65c232
1 changed files with 3 additions and 3 deletions
  1. 3 3
      htdocs/core/lib/xcal.lib.php

+ 3 - 3
htdocs/core/lib/xcal.lib.php

@@ -203,9 +203,9 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
 				$startdatef = dol_print_date($startdate, "dayhourxcard", 'gmt');
 
 				if ($fulldayevent) {
-					// Local time
+					// Local time should be used to prevent users in time zones earlier than GMT from being one day earlier
 					$prefix     = ";VALUE=DATE";
-					$startdatef = dol_print_date($startdate, "dayxcard", 'gmt');
+					$startdatef = dol_print_date($startdate, "dayxcard", 'tzserver');
 				}
 
 				fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n");
@@ -232,7 +232,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
 					// We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event)
 					// This is mention in https://datatracker.ietf.org/doc/html/rfc5545:
 					// "The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event."
-					$enddatef = dol_print_date($enddate + 1, "dayxcard", 'gmt');
+					$enddatef = dol_print_date($enddate + 1, "dayxcard", 'tzserver');
 				}
 
 				fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n");