PrestaShop Developer Conference
PrestaShop Developer Conference
Paris, France - November 6, 2024
Let's talk code, commerce and open source.

Notice: You are browsing the documentation for PrestaShop 9, which is currently in development.

You might want to read the documentation for the current version, PrestaShop 8. Read the current version of this page

DatePickerType

DatePickerType creates a field with a date picker. It uses Javascript, but doesn’t require any specific components, as it’s already enabled globally.

Custom options

None.

Required Javascript components

None.

Code example

<?php
// path/to/your/CustomType.php

use PrestaShopBundle\Form\Admin\Type\DatePickerType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class CustomType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('date_from', DatePickerType::class)
            ->add('date_to', DatePickerType::class);
    }
}

Preview example

DatePickerType rendered in form example