anh/datetimepicker-bundle

Symfony bundle which implements jQuery UI date and time pickers in a Form Type Extension.

Maintainers

👁 hilobok

Package info

github.com/hilobok/AnhDateTimePickerBundle

Type:symfony-bundle

pkg:composer/anh/datetimepicker-bundle

Statistics

Installs: 259

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.2 2014-01-16 09:48 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 6a4d495bd3e2f4ed0e71ab71cd82f947e154a3bf

  • Andrew Hilobok <hilobok.woop@gmail.com>

This package is auto-updated.

Last update: 2026-06-06 12:18:15 UTC


README

Symfony bundle which implements jQuery UI date and time pickers in a Form Type Extension.

Download using composer

$ php composer.phar require anh/datetimepicker-bundle

Enable the bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
 $bundles = array(
 // ...
 new Anh\DateTimePickerBundle\AnhDateTimePickerBundle(),
 );
}

Install assets

$ app/console sp:bower:install

Create form field(s)

<?php
// Form/ExampleType.php

public function buildForm(FormBuilderInterface $builder, array $options)
{
 // ...
 $builder
 ->add('dateTimeField', 'datetime', array(
 'picker' => true,
 'format' => 'yyyy-MM-dd HH:mm:ss',
 'separator' => ''
 ))
 ;
 // ...
 $builder
 ->add('dateField', 'date', array(
 'picker' => true,
 'format' => 'dd.MM.yyyy'
 ))
 ;
 // ...
 $builder
 ->add('timeField', 'time', array(
 'picker' => true,
 'with_seconds' => true
 ))
 ;
 // ...
}

Include resources

Bundle provides assets for javascript and stylesheet — @anh_dateTimePicker_js and @anh_dateTimePicker_css. Don't forget to include jQuery and jQuery UI.

{% block javascripts %}
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
 <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>

 {% javascripts
 '@anh_dateTimePicker_js'
 %}<script src="{{ asset_url }}"></script>{% endjavascripts %}
{% endblock %}
{% block stylesheets %}
 <link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.min.css" rel="stylesheet">

 {% stylesheets
 '@anh_dateTimePicker_css'
 %}<link rel="stylesheet" href="{{ asset_url }}" />{% endstylesheets %}
{% endblock %}