public function setDateTimes(array $dt, $isFloating = false)
    {
        $values = [];

        if ($this->hasTime()) {
            $tz = null;
            $isUtc = false;

            foreach ($dt as $d) {
                if ($isFloating) {
                    $values[] = $d->format('Ymd\\THis');
                    continue;
                }
                if (is_null($tz)) {
                    $tz = $d->getTimeZone();
                    $isUtc = in_array($tz->getName(), ['UTC', 'GMT', 'Z', '+00:00']);
                    if (!$isUtc) {
                        $this->offsetSet('TZID', $tz->getName());
                    }
                } else {
                    $d = $d->setTimeZone($tz);
                }

                if ($isUtc) {
                    $values[] = $d->format('Ymd\\THis\\Z');
                } else {
                    $values[] = $d->format('Ymd\\THis');
                }
            }
            if ($isUtc || $isFloating) {
                $this->offsetUnset('TZID');
            }
        } else {
            foreach ($dt as $d) {
                $values[] = $d->format('Ymd');
            }
            $this->offsetUnset('TZID');
        }

        $this->value = $values;
    }
public function setDateTimes(array $dt, $isFloating = false)
    {
        $values = [];

        if ($this->hasTime()) {
            $tz = null;
            $isUtc = false;

            foreach ($dt as $d) {
                if ($isFloating) {
                    $values[] = $d->format('Ymd\\THis');
                    continue;
                }
                if (is_null($tz)) {
                    $tz = $d->getTimeZone();
                    $isUtc = in_array($tz->getName(), ['UTC', 'GMT', 'Z', '+00:00']);
                    if (!$isUtc) {
                        $this->offsetSet('TZID', $tz->getName());
                    }
                } else {
                    $d = $d->setTimeZone($tz);
                }

                if ($isUtc) {
                    $values[] = $d->format('Ymd\\THis\\Z');
                } else {
                    $values[] = $d->format('Ymd\\THis');
                }
            }
            if ($isUtc || $isFloating) {
                $this->offsetUnset('TZID');
            }
        } else {
            foreach ($dt as $d) {
                $values[] = $d->format('Ymd');
            }
            $this->offsetUnset('TZID');
        }

        $this->value = $values;
    }
public function setDateTimes ( array $ dt , $ isFloating = false ) { $ values = [ ] ; if ( $ this -> hasTime ( ) ) { $ tz = null ; $ isUtc = false ; foreach ( $ dt as $ d ) { if ( $ isFloating ) { $ values [ ] = $ d -> format ( 'Ymd\\THis' ) ; continue ; } if ( is_null ( $ tz ) ) { $ tz = $ d -> getTimeZone ( ) ; $ isUtc = in_array ( $ tz -> getName ( ) , [ 'UTC' , 'GMT' , 'Z' , '+00:00' ] ) ; if ( ! $ isUtc ) { $ this -> offsetSet ( 'TZID' , $ tz -> getName ( ) ) ; } } else { $ d = $ d -> setTimeZone ( $ tz ) ; } if ( $ isUtc ) { $ values [ ] = $ d -> format ( 'Ymd\\THis\\Z' ) ; } else { $ values [ ] = $ d -> format ( 'Ymd\\THis' ) ; } } if ( $ isUtc || $ isFloating ) { $ this -> offsetUnset ( 'TZID' ) ; } } else { foreach ( $ dt as $ d ) { $ values [ ] = $ d -> format ( 'Ymd' ) ; } $ this -> offsetUnset ( 'TZID' ) ; } $ this -> value = $ values ; }
Sets the property as multiple date-time objects.

The first value will be used as a reference for the timezones, and all
the otehr values will be adjusted for that timezone

@param DateTimeInterface[] $dt
@param bool isFloating If set to true, timezones will be ignored
Sets the property as multiple date - time objects .