$pattern = \
is_string($options['format'
]) ?
$options['format'
] : '';
if (!\
in_array($dateFormat, self::ACCEPTED_FORMATS, true
)) { throw new InvalidOptionsException('The "format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.'
);
} if ('single_text' ===
$options['widget'
]) { if ('' !==
$pattern && !
str_contains($pattern, 'y'
) && !
str_contains($pattern, 'M'
) && !
str_contains($pattern, 'd'
)) { throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" or "d". Its current value is "%s".',
$pattern));
} $builder->
addViewTransformer(new DateTimeToLocalizedStringTransformer( $options['model_timezone'
],
$options['view_timezone'
],
$dateFormat,
$timeFormat,
$calendar,
$pattern ));
} else { if ('' !==
$pattern && (!
str_contains($pattern, 'y'
) || !
str_contains($pattern, 'M'
) || !
str_contains($pattern, 'd'
))) { throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".',
$pattern));
}