Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mwsimple/scdatetimepickerbundle
Datetime Picker Bundle Symfony 3
https://github.com/mwsimple/scdatetimepickerbundle
datetimepicker symfony
Last synced: about 1 month ago
JSON representation
Datetime Picker Bundle Symfony 3
- Host: GitHub
- URL: https://github.com/mwsimple/scdatetimepickerbundle
- Owner: MWSimple
- License: mit
- Created: 2017-12-07T15:56:01.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-07T13:16:26.000Z (3 months ago)
- Last Synced: 2024-12-12T14:22:32.701Z (about 1 month ago)
- Topics: datetimepicker, symfony
- Language: PHP
- Homepage:
- Size: 88.9 KB
- Stars: 10
- Watchers: 4
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#DatetimepickerBundle
This bundle implements the [Bootstrap DateTime Picker](https://github.com/smalot/bootstrap-datetimepicker) in a Form Type for Symfony 3. The bundle structure is inspired by GenemuFormBundle.
Demo : http://www.malot.fr/bootstrap-datetimepicker/demo.php
Please feel free to contribute, to fork, to send merge request and to create ticket.
##Installation
### Step 1: Install DatetimepickerBundle
```bash
php composer.phar require mwsimple/scdatetimepicker-bundle
```### Step 2: Enable the bundle
``` php
add('createdAt', DatetimeType::class)
// 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
))) ;}
```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 %}
{{ form_stylesheet(form) }}
{% endblock %}{% block javascripts %}
{{ 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
## 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