public function reverseTransform($value, $originalValue)
{
$inputTimezone = $this->getOption('input_timezone');
if (!is_string($value)) {
throw new \InvalidArgumentException(sprintf('Expected argument of type string, %s given', gettype($value)));
}
if ($value === '') {
return null;
}
$timestamp = $this->getIntlDateFormatter()->parse($value);
if (intl_get_error_code() != 0) {
throw new TransformationFailedException(intl_get_error_message());
}
// read timestamp into DateTime object - the formatter delivers in UTC
$dateTime = new \DateTime(sprintf('@%s UTC', $timestamp));
if ($inputTimezone != 'UTC') {
$dateTime->setTimezone(new \DateTimeZone($inputTimezone));
}
return $dateTime;
}