public function visitDate($data, Property\DateType $property, $path) { if ($this->validate) { parent::visitDate($data, $property, $path); } else { $this->assertRequired($data, $property, $path); } if ($data instanceof \DateTime) { return $this->createSimpleProperty(Date::fromDateTime($data), $property); } try { return $this->createSimpleProperty(new Date($data), $property); } catch (\Exception $e) { throw new ValidationException($path . ' must be an valid full-date format (date-fullyear "-" date-month "-" date-mday) [RFC3339]'); } }