diff --git a/web/import.php b/web/import.php index 3096ec8bab..b8c96e6196 100644 --- a/web/import.php +++ b/web/import.php @@ -171,6 +171,24 @@ function get_room_id($location, &$error) } +// Turn an EXDATE property into an array of timestamps +function get_skip_list(string $values, array $params) : array +{ + $result = array(); + + $tzid = $params['TZID'] ?? 'UTC'; + $date_time_zone = new \DateTimeZone($tzid); + $exdates = explode(',', $values); + + foreach ($exdates as $exdate) + { + $date = new DateTime($exdate, $date_time_zone); + $result[] = $date->getTimestamp(); + } + + return $result; +} + // Get the next line, after unfolding, from the stream. // Returns FALSE when EOF is reached function get_unfolded_line($handle) @@ -364,6 +382,10 @@ function process_event(array $vevent) } break; + case 'EXDATE': + $booking['skip_list'] = get_skip_list($details['value'], $details['params']); + break; + case 'CLASS': $booking['private'] = in_array($details['value'], array('PRIVATE', 'CONFIDENTIAL')); break;