Created
December 3, 2019 08:25
-
-
Save wapcrazut/2ccb436ec954d1b45ae8018c7bf69c2d to your computer and use it in GitHub Desktop.
HTML5 Native datepicker for Symfony 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Form; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\Extension\Core\Type\DateType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\OptionsResolver\OptionsResolver; | |
class DatePickerType extends AbstractType | |
{ | |
public function configureOptions(OptionsResolver $resolver) | |
{ | |
$resolver->setDefaults([ | |
'widget' => 'single_text', | |
'format' => 'yyyy-MM-dd', | |
'html5' => true, | |
]); | |
} | |
public function getParent() | |
{ | |
return DateType::class; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment