Form/Extension/DatetimeTypeExtension.php
public function buildView(FormView $view, FormInterface $form, array $options)
    {
        $pickerOptions = $options['picker_options'];

        // Set automatically the language
        if (!isset($options['picker_options']['locale'])) {
            $pickerOptions['locale'] = \Locale::getDefault();
        }
        if ($pickerOptions['locale'] == 'en') {
            unset($pickerOptions['locale']);
        }

        // Convert format for moment.js
        $pickerOptions['format'] = MomentFormatConverter::convert($options['format']);

        $view->vars = array_replace($view->vars, [
            'picker_options' => $pickerOptions,
        ]);
    }
public function buildView(FormView $view, FormInterface $form, array $options)
    {
        $pickerOptions = $options['picker_options'];

        // Set automatically the language
        if (!isset($options['picker_options']['locale'])) {
            $pickerOptions['locale'] = \Locale::getDefault();
        }
        if ($pickerOptions['locale'] == 'en') {
            unset($pickerOptions['locale']);
        }

        // Convert format for moment.js
        $pickerOptions['format'] = MomentFormatConverter::convert($options['format']);

        $view->vars = array_replace($view->vars, [
            'picker_options' => $pickerOptions,
        ]);
    }
{@inheritdoc}