Custom masked date input field with integrated Flatpickr calendar and custom footer buttons (Today / Clear) for Symfony 8+ and AssetMapper (Symfony UX).
dd.mm.yyyy dynamically).Run the following command in your Symfony project:
composer require corvet/light-field-bundle
Since this bundle relies on flatpickr and inputmask via AssetMapper, import them into your application's importmap.php:
php bin/console importmap:require flatpickr inputmask
bin/console importmap:require flatpickr/dist/themes/dark.css
Simply use LightDateType::class in your Symfony forms:
use Corvet\LightFieldBundle\Form\LightDateType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class OrderType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('createdAt', LightDateType::class, [
'label' => 'Select Date',
]);
}
}
MIT License. See LICENSE for more information.
How can I help you explore Laravel packages today?