mablae/datetimepicker-bundle

Symfony bundle for Bootstrap3 DateTime picker

Installs: 4 235

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 4

Open Issues: 2

Type:symfony-bundle

0.2.3 2016-02-16 14:54 UTC

This package is not auto-updated.

Last update: 2024-11-09 19:56:10 UTC


README

Warning: This is abadoned and incomplete! Uses at your own rik.

Packagist

This bundle implements the Bootstrap DateTime Picker v4 in a Form Type for Symfony 2.*. The bundle structure is inspired by GenemuFormBundle.

Please feel free to contribute, to fork, to send merge request and to create ticket.

Installation

Step 1: Install DatetimepickerBundle

php composer.phar require mablae/datetimepicker-bundle

Step 2: Enable the bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Mablae\DatetimepickerBundle\MablaeDatetimepickerBundle(),
    );
}
# app/config/config.yml
mablae_datetimepicker:
    picker: ~

Step 3: Install moment.js and Bootstrap3 Datepicker

This bundle does not handle an asset minification or loading. Just use gulp or webpack.

http://eonasdan.github.io/bootstrap-datetimepicker/Installing/

Usages

<?php
// ...
use Mablae\DatetimepickerBundle\Form\Type\DateTimeType;

public function buildForm(FormBuilder $builder, array $options)
{
    $builder
        // defaut options
        ->add('createdAt', DateTimeType::class) 
        
        // full options
        ->add('updatedAt', DateTimeType::class, array( 'pickerOptions' =>
            array('format' => 'mm/dd/yyyy',
                'viewMode' => 'days', // days, month, years, decades
                                     
                ))); 
                
}

Include the javascript needed to initialize the widget:

...
{{ form_javascript(your.form.field) }}
...