2017 © Pedro PelĂĄez
 

symfony-bundle datetimepicker-bundle

Symfony bundle for Bootstrap DateTime picker

image

alexvasilyev/datetimepicker-bundle

Symfony bundle for Bootstrap DateTime picker

  • Monday, December 11, 2017
  • by xiro
  • Repository
  • 1 Watchers
  • 0 Stars
  • 463 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 58 Forks
  • 0 Open issues
  • 3 Versions
  • 11 % Grown

The README.md

DatetimepickerBundle

This bundle implements the Bootstrap DateTime Picker in a Form Type for Symfony 3.* and ^4.0. The bundle structure is inspired by GenemuFormBundle., (*1)

Demo : http://www.malot.fr/bootstrap-datetimepicker/demo.php, (*2)

Please feel free to contribute, to fork, to send merge request and to create ticket., (*3)

Installation

Step 1: Install DatetimepickerBundle

Add the following dependency to your composer.json file:, (*4)

``` json { "require": {, (*5)

    "alexvasilyev/datetimepicker-bundle": "dev-master"
}

}, (*6)


and then run ```bash php composer.phar update stephanecollot/datetimepicker-bundle

Step 2: Enable the bundle

Symfony 3 ``` php <?php // app/AppKernel.php, (*7)

public function registerBundles() { $bundles = array( // ... new SC\DatetimepickerBundle\SCDatetimepickerBundle(), ); }, (*8)


Symfony 4 ``` php <?php // config/bundles.php return [ // ... SC\DatetimepickerBundle\SCDatetimepickerBundle::class => ['all' => true], ];

Symfony 3 ``` yml, (*9)

app/config/config.yml

sc_datetimepicker: picker: ~, (*10)


Symfony 4 ``` yml # config/packages/sc_datetimepicker.yaml sc_datetimepicker: picker: ~

Step 3: Initialize assets

Symfony 3 ``` bash $ php app/console assets:install web/, (*11)


Symfony 4 ``` bash $ php app/console assets:install public/

Usages

``` php <?php // ... use SC\DatetimepickerBundle\Form\Type\DatetimeType;, (*12)

public function buildForm(FormBuilder $builder, array $options) { $builder // defaut options ->add('createdAt', DatetimeType::class), (*13)

    // full options
    ->add('updatedAt', DatetimeType::class, array( 'pickerOptions' =>
        array('format' => 'mm/dd/yyyy',
            'weekStart' => 0,
            'startDate' => date('m/d/Y'), //example
            'endDate' => '01/01/3000', //example
            'daysOfWeekDisabled' => '0,6', //example
            'autoclose' => false,
            'startView' => 'month',
            'minView' => 'hour',
            'maxView' => 'decade',
            'todayBtn' => false,
            'todayHighlight' => false,
            'keyboardNavigation' => true,
            'language' => 'en',
            'forceParse' => true,
            'minuteStep' => 5,
            'pickerReferer ' => 'default', //deprecated
            'pickerPosition' => 'bottom-right',
            'viewSelect' => 'hour',
            'showMeridian' => false,
            'initialDate' => date('m/d/Y', 1577836800), //example
            ))) ; 

}, (*14)


Add form_javascript and form_stylesheet The principle is to separate the javascript, stylesheet and html. This allows better integration of web pages. ### Example: ``` twig {% block stylesheets %} <link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet" /> {{ form_stylesheet(form) }} {% endblock %} {% block javascripts %} <script src="{{ asset('js/bootstrap.min.js') }}"></script> {{ form_javascript(form) }} {% endblock %} {% block body %}
{{ form_widget(form) }}
{% endblock %}

Documentation

The documentation of the datetime picker is here : http://www.malot.fr/bootstrap-datetimepicker/#options, (*15)

Notes

The date format from php 'pickerOptions' => array('format'=>'dd MM yyyy - HH:ii p') is used to set automatically the date format of Symfony in order to make compatible Symfony and JavaScript output. But there are some problems for example with php MM which display "décembre" in PHP intl translation and "Decembre" in Bootstrap translation. That is why I edited js/locales/bootstrap-datetimepicker.fr.js, (*16)

The Versions

11/12 2017

dev-master

9999999-dev

Symfony bundle for Bootstrap DateTime picker

  Sources   Download

MIT

The Requires

 

by Stephane Collot

bootstrap bundle symfony datepicker timepicker picker

27/02 2015

1.0.1

1.0.1.0

Symfony bundle for Bootstrap DateTime picker

  Sources   Download

MIT

The Requires

 

by Stephane Collot

bootstrap bundle symfony datepicker timepicker picker

27/02 2015

0.1.0.x-dev

0.1.0.9999999-dev

Symfony bundle for Bootstrap DateTime picker

  Sources   Download

MIT

The Requires

 

by Stephane Collot

bootstrap bundle symfony datepicker timepicker picker