diff --git a/Form/Type/ChillDateTimeType.php b/Form/Type/ChillDateTimeType.php new file mode 100644 index 000000000..71c1b2680 --- /dev/null +++ b/Form/Type/ChillDateTimeType.php @@ -0,0 +1,48 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +namespace Chill\MainBundle\Form\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\DateTimeType; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * Display the date in a date picker. + * + * Extends the symfony `Symfony\Component\Form\Extension\Core\Type\DateType` + * to automatically create a date picker. + * + * @author Julien Fastré + */ +class ChillDateTimeType extends AbstractType +{ + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('date_widget', 'single_text') + ->setDefault('date_format', 'dd-MM-yyyy') + ->setDefault('time_widget', 'choice') + ->setDefault('html5', true) + ; + } + + public function getParent() + { + return DateTimeType::class; + } +}