/** * Transforms a normalized date into a localized date string/array. * * @param Date $dateTime A DateTime object * * @return string|array Localized date string/array. * * @throws TransformationFailedException If the given value is not an instance * of Date or if the date could not * be transformed. */ public function transform($dateTime) { if (null === $dateTime) { return ''; } if (!$dateTime instanceof Date) { throw new TransformationFailedException('Expected a Date.'); } $value = $this->getIntlDateFormatter()->format($dateTime->getTimestamp()); if (intl_get_error_code() != 0) { throw new TransformationFailedException(intl_get_error_message()); } return $value; }