[Form] Removed an exception that prevented valid formats from being passed, e.g. "h" for the hour, "L" for the month etc.

This commit is contained in:
Bernhard Schussek 2012-11-09 17:22:53 +01:00
parent ae61d354c9
commit 0f75586248

View File

@ -87,10 +87,6 @@ class DateTimeType extends AbstractType
throw new InvalidOptionsException('The "date_format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.');
}
if (null !== $pattern && (false === strpos($pattern, 'y') || false === strpos($pattern, 'M') || false === strpos($pattern, 'd') || false === strpos($pattern, 'H') || false === strpos($pattern, 'm'))) {
throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M", "d", "H" and "m". Its current value is "%s".', $pattern));
}
if ('single_text' === $options['widget']) {
if (self::HTML5_FORMAT === $pattern) {
$builder->addViewTransformer(new DateTimeToRfc3339Transformer(