48 if (isset($parts[0]) && $parts[0] instanceof DateTimeInterface) {
51 parent::setParts($parts);
71 } elseif (
$value instanceof DateTimeInterface) {
91 $this->
setValue(explode($this->delimiter, $val));
102 return implode($this->delimiter, $this->
getParts());
113 return strtoupper((
string)$this[
'VALUE']) !==
'DATE';
127 !isset($this[
'TZID']) &&
128 strpos($this->
getValue(),
'Z') === false
172 $tzid = $this[
'TZID'];
179 foreach ($this->
getParts() as $part) {
194 function setDateTime(DateTimeInterface $dt, $isFloating =
false) {
220 foreach ($dt as
$d) {
227 $tz =
$d->getTimeZone();
228 $isUtc = in_array(
$tz->getName(), [
'UTC',
'GMT',
'Z',
'+00:00']);
233 $d =
$d->setTimeZone(
$tz);
243 if ($isUtc || $isFloating) {
249 foreach ($dt as
$d) {
272 return $this->
hasTime() ?
'DATE-TIME' :
'DATE';
289 $tz = $dts[0]->getTimeZone();
290 $isUtc = $isFloating ? false : in_array(
$tz->getName(), [
'UTC',
'GMT',
'Z']);
293 function(DateTimeInterface $dt) use ($hasTime, $isUtc) {
296 return $dt->format(
'Y-m-d\\TH:i:s') . ($isUtc ?
'Z' :
'');
298 return $dt->format(
'Y-m-d');
326 return strtr($item, [
':' =>
'',
'-' =>
'']);
347 if (strtoupper(
$name) !==
'VALUE') {
385 switch ($valueType) {
397 'message' =>
'The supplied value (' .
$value .
') is not a correct ' . $valueType,
An exception for terminatinating execution or to throw for unit testing.
static parse($date, $referenceTz=null)
Parses either a Date or DateTime, or Duration value.
static parseDateTime($dt, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted datetime and returns a DateTimeImmutable object.
static parseDate($date, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted date and returns a DateTimeImmutable object.
This exception is thrown whenever an invalid value is found anywhere in a iCalendar or vCard object.
setDateTimes(array $dt, $isFloating=false)
Sets the property as multiple date-time objects.
getJsonValue()
Returns the value, in the format it should be encoded for JSON.
getDateTime(DateTimeZone $timeZone=null)
Returns a date-time value.
getValueType()
Returns the type of value.
setValue($value)
Updates the current value.
setDateTime(DateTimeInterface $dt, $isFloating=false)
Sets the property as a DateTime object.
hasTime()
Returns true if this is a DATE-TIME value, false if it's a DATE.
offsetSet($name, $value)
We need to intercept offsetSet, because it may be used to alter the VALUE from DATE-TIME to DATE or v...
validate($options=0)
Validates the node for correctness.
isFloating()
Returns true if this is a floating DATE or DATE-TIME.
getRawMimeDirValue()
Returns a raw mime-dir representation of the value.
setJsonValue(array $value)
Sets the json value, as it would appear in a jCard or jCal object.
getDateTimes(DateTimeZone $timeZone=null)
Returns multiple date-time values.
setParts(array $parts)
Sets a multi-valued property.
setRawMimeDirValue($val)
Sets a raw value coming from a mimedir (iCalendar/vCard) file.
offsetUnset($name)
Removes one or more parameters with the specified name.
getParts()
Returns a multi-valued property.
getValue()
Returns the current value.
Time zone name translation.
static getTimeZone($tzid, Component $vcalendar=null, $failIfUncertain=false)
This method will try to find out the correct timezone for an iCalendar date-time value.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d