Skip to content

Commit 6c6bbda

Browse files
committed
feat: Gestione timezone in API esportazione calendario
1 parent 0f15486 commit 6c6bbda

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

modules/interventi/src/API/v1/Sync.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ public function retrieve($request)
7878
$result .= "VERSION:2.0\r\n";
7979
$result .= "PRODID:-// OpenSTAManager\r\n";
8080

81+
//VTIMEZONE completo
82+
$result .= "BEGIN:VTIMEZONE\r\n";
83+
$result .= "TZID:Europe/Rome\r\n";
84+
$result .= "BEGIN:STANDARD\r\n";
85+
$result .= "DTSTART:19701025T030000\r\n";
86+
$result .= "TZOFFSETFROM:+0200\r\n";
87+
$result .= "TZOFFSETTO:+0100\r\n";
88+
$result .= "TZNAME:CET\r\n";
89+
$result .= "END:STANDARD\r\n";
90+
$result .= "BEGIN:DAYLIGHT\r\n";
91+
$result .= "DTSTART:19700329T020000\r\n";
92+
$result .= "TZOFFSETFROM:+0100\r\n";
93+
$result .= "TZOFFSETTO:+0200\r\n";
94+
$result .= "TZNAME:CEST\r\n";
95+
$result .= "END:DAYLIGHT\r\n";
96+
$result .= "END:VTIMEZONE\r\n";
97+
8198
foreach ($rs as $r) {
8299
$description = str_replace("\r\n", "\n", strip_tags((string) $r['richiesta']));
83100
$description = str_replace("\r", "\n", $description);
@@ -90,8 +107,8 @@ public function retrieve($request)
90107
$result .= "BEGIN:VEVENT\r\n";
91108
$result .= 'UID:'.$r['idriga']."\r\n";
92109
$result .= 'DTSTAMP:'.$now->format('Ymd\THis')."\r\n";
93-
$result .= 'DTSTART:'.$inizio->format('Ymd\THis')."\r\n";
94-
$result .= 'DTEND:'.$fine->format('Ymd\THis')."\r\n";
110+
$result .= 'DTSTART;TZID=Europe/Rome:'.$inizio->format('Ymd\THis')."\r\n";
111+
$result .= 'DTEND;TZID=Europe/Rome:'.$fine->format('Ymd\THis')."\r\n";
95112
$result .= 'SUMMARY:'.html_entity_decode($r['summary'])."\r\n";
96113
$result .= 'DESCRIPTION:'.html_entity_decode($description, ENT_QUOTES, 'UTF-8')."\r\n";
97114
$result .= "END:VEVENT\r\n";

0 commit comments

Comments
 (0)