From b452d54dd30ae44979c0ff1a09ebb8db4aeaa3e4 Mon Sep 17 00:00:00 2001 From: Christopher Teutsch Date: Fri, 21 Feb 2020 21:52:27 +0100 Subject: [PATCH] Parse event durations --- index.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 0ccaeb8..834bbb5 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,7 @@ (object) array( 'state_string' => 'Das Dorf ist gerade geschlossen.', @@ -80,9 +81,7 @@ $v = file_get_contents('/media/sg/dorf.jetzt_visitors');
Türstatus
- - svg ?> - + svg ?>

state_string ?>

What's this? @@ -96,14 +95,23 @@ $v = file_get_contents('/media/sg/dorf.jetzt_visitors');
Nächste Veranstaltung

summary, ENT_QUOTES, 'UTF-8') ?>
- iCalDateToDateTime($first_event->dtstart_array[3])->format('Y-m-d H:i'); ?> + iCalDateToDateTime($first_event->dtstart_array[3])->format($DATE_FORMAT) ?>

Danach:
- +
iCalDateToDateTime($event->dtstart_array[3])->format('Y-m-d H:i') ?>iCalDateToDateTime($event->dtstart_array[3]); + $startdate_str = $startdate_loop->format($DATE_FORMAT); + $interval_loop = new DateInterval($event->duration); + if ($interval_loop->d != 0 || $interval_loop->h >= 24){ + $enddate_str = $startdate_loop->add($interval_loop)->format($DATE_FORMAT); + }else{ + $enddate_str = $startdate_loop->add($interval_loop)->format('H:i'); + } + echo($startdate_str . ' — ' . $enddate_str); ?> summary) ?>