diff options
author | Mario <mario@mariovavti.com> | 2020-04-05 09:11:12 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-04-05 09:11:12 +0000 |
commit | 84183d9f7ef669779841cfccd65aae8000012e6d (patch) | |
tree | 5b0e5d65b73dbe3f2b560ad59551665c885726a7 /include/event.php | |
parent | 805f8bf98377d17593dfe884eac5c69079b83eed (diff) | |
download | volse-hubzilla-84183d9f7ef669779841cfccd65aae8000012e6d.tar.gz volse-hubzilla-84183d9f7ef669779841cfccd65aae8000012e6d.tar.bz2 volse-hubzilla-84183d9f7ef669779841cfccd65aae8000012e6d.zip |
show event timezone only if adjust ist set and the offset of the event timezone is different from the channel default timezone offset
Diffstat (limited to 'include/event.php')
-rw-r--r-- | include/event.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/include/event.php b/include/event.php index c8f9d2561..69ca64e0f 100644 --- a/include/event.php +++ b/include/event.php @@ -77,14 +77,22 @@ function format_event_obj($jobject) { if(array_key_exists('description', $object)) { $event_tz = ''; - if(is_array($object['asld']) && isset($object['asld']['attachment'])) { + if($object['adjust'] && is_array($object['asld']) && is_array($object['asld']['attachment'])) { foreach($object['asld']['attachment'] as $attachment) { if($attachment['type'] === 'PropertyValue' && $attachment['name'] == 'zot.event.timezone' ) { - $event_tz = $attachment['value']; + // check if the offset of the timezones is different and only set event_tz if offset is not the same + $local_tz = new DateTimeZone(date_default_timezone_get()); + $local_dt = new DateTime('now', $local_tz); + + $ev_tz = new DateTimeZone($attachment['value']); + $ev_dt = new DateTime('now', $ev_tz); + + if($local_dt->getOffset() !== $ev_dt->getOffset()) + $event_tz = $attachment['value']; + break; } } - } $allday = (($object['adjust']) ? false : true); |