Creates a date object from an array of date parts.
Converts the input value into an ISO date, forcing a full ISO date even if some values are missing.
protected function constructFromArray() {
try {
parent::__construct('', $this->inputTimeZoneAdjusted);
$this->inputTimeAdjusted = static::prepareArray($this->inputTimeAdjusted, TRUE);
if (static::checkArray($this->inputTimeAdjusted)) {
// Even with validation, we can end up with a value that the
// parent class won't handle, like a year outside the range
// of -9999 to 9999, which will pass checkdate() but
// fail to construct a date object.
$this->inputTimeAdjusted = static::arrayToISO($this->inputTimeAdjusted);
parent::__construct($this->inputTimeAdjusted, $this->inputTimeZoneAdjusted);
}
else {
throw new \Exception('The array contains invalid values.');
}
} catch (\Exception $e) {
$this->errors[] = $e
->getMessage();
}
}