All Projects → 2amigos → Yii2 Date Picker Widget

2amigos / Yii2 Date Picker Widget

Licence: other
Bootstrap DatePicker Widget for Yii2

Projects that are alternatives of or similar to Yii2 Date Picker Widget

yii2-datetime-widgets
Datetime widgets for Yii2
Stars: ✭ 22 (-82.81%)
Mutual labels:  widget, yii2, datepicker
yii2-google-analytics
Google Analytics Universal tracking widget.
Stars: ✭ 14 (-89.06%)
Mutual labels:  widget, yii2
yii2-cookiemonster
Yii extension to manage cookie warning
Stars: ✭ 16 (-87.5%)
Mutual labels:  widget, yii2
yii2-number
A number format mask control and input for Yii2 Framework
Stars: ✭ 22 (-82.81%)
Mutual labels:  widget, yii2
mithril-datepicker
Pick a date! But only if you're using Mithril. (component for Mithril.js ^v1.0)
Stars: ✭ 23 (-82.03%)
Mutual labels:  widget, datepicker
yii2-widget-cropbox
This widget allows crop image before upload to server and send informations about crop in JSON format.
Stars: ✭ 90 (-29.69%)
Mutual labels:  widget, yii2
yii2-multi-select-widget
Bootstrap MultiSelect and MultiSelect Listbox widgets for Yii2
Stars: ✭ 45 (-64.84%)
Mutual labels:  widget, yii2
yii2-grid-view-library
Highly enhanced GridView widget and grid components for Yii2
Stars: ✭ 57 (-55.47%)
Mutual labels:  widget, yii2
Yii2 Fullcalendar
Widget for Yii Framework 2.0 to use FullCalendar
Stars: ✭ 5 (-96.09%)
Mutual labels:  yii2, widget
Yii2 Fotorama Widget
Fotorama image gallery widget for yii2
Stars: ✭ 18 (-85.94%)
Mutual labels:  yii2, widget
Yii2 Quill
Yii 2 implementation of Quill, modern WYSIWYG editor
Stars: ✭ 52 (-59.37%)
Mutual labels:  yii2, widget
Circularpicker
CircularPicker is helpful for creating a controller aimed to manage any calculated parameter.
Stars: ✭ 73 (-42.97%)
Mutual labels:  widget, datepicker
yii2-content-tools
ContentTools editor implementation for Yii 2
Stars: ✭ 79 (-38.28%)
Mutual labels:  widget, yii2
yii2-highcharts-widget
HighCharts Js Widget for Yii2
Stars: ✭ 40 (-68.75%)
Mutual labels:  widget, yii2
yii2-switch-widget
Bootstrap Switch Widget for Yii2
Stars: ✭ 17 (-86.72%)
Mutual labels:  widget, yii2
yii2-time-down-counter
Widget for yii2, to start count down timer with a lot of options, This widget build dependence of timeDownCounter JS library
Stars: ✭ 15 (-88.28%)
Mutual labels:  widget, yii2
Yii2 Imperavi Widget
Imperavi Redactor widget for Yii 2
Stars: ✭ 250 (+95.31%)
Mutual labels:  yii2, widget
yii2-notification-wrapper
Yii2-notification-wrapper module renders a message from session flash (with ajax, pjax support and etc.) through Growl, Noty, Toastr and more libraries
Stars: ✭ 78 (-39.06%)
Mutual labels:  widget, yii2
Yii2 Sortable Widgets
🍨 Rubaxa/Sortable for Yii2
Stars: ✭ 54 (-57.81%)
Mutual labels:  yii2, widget
Hibiscus.js
Native Angular directives for Bootstrap4
Stars: ✭ 115 (-10.16%)
Mutual labels:  widget, datepicker

Bootstrap DatePicker Widget for Yii2

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Renders a Bootstrap DatePicker plugin.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require 2amigos/yii2-date-picker-widget:~1.0

or add

"2amigos/yii2-date-picker-widget" : "~1.0"

to the require section of your application's composer.json file.

Usage

The widget comes in two flavors:

  • DatePicker
  • DateRangePicker

DatePicker

This widget renders a Bootstrap DatePicker input control. Best suitable for model with date string attribute.

Example of use with a form
There are two ways of using it, with an ActiveForm instance or as a widget setting up its model and attribute.

<?php
use dosamigos\datepicker\DatePicker;

// as a widget
?>

<?= DatePicker::widget([
    'model' => $model,
    'attribute' => 'date',
    'template' => '{addon}{input}',
        'clientOptions' => [
            'autoclose' => true,
            'format' => 'dd-M-yyyy'
        ]
]);?>

<?php 
// with an ActiveForm instance 
?>
<?= $form->field($model, 'date')->widget(
    DatePicker::className(), [
        // inline too, not bad
         'inline' => true, 
         // modify template for custom rendering
        'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>',
        'clientOptions' => [
            'autoclose' => true,
            'format' => 'dd-M-yyyy'
        ]
]);?>

Example of use without a model

<?php
use dosamigos\datepicker\DatePicker;
?>
<?= DatePicker::widget([
    'name' => 'Test',
    'value' => '02-16-2012',
    'template' => '{addon}{input}',
        'clientOptions' => [
            'autoclose' => true,
            'format' => 'dd-M-yyyy'
        ]
]);?>

DateRangePicker

This widget renders a Bootstrap DateRangePicker Input control.

Example of use with a form
The following example works with a model that has two attributes named date_from and date_to.

<?php
use dosamigos\datepicker\DateRangePicker;
?>
<?= $form->field($tour, 'date_from')->widget(DateRangePicker::className(), [
    'attributeTo' => 'date_to', 
    'form' => $form, // best for correct client validation
    'language' => 'es',
    'size' => 'lg',
    'clientOptions' => [
        'autoclose' => true,
        'format' => 'dd-M-yyyy'
    ]
]);?>

Example of use without a model

<?php
use dosamigos\datepicker\DateRangePicker;
?>
<?= DateRangePicker::widget([
    'name' => 'date_from',
    'value' => '02-16-2012',
    'nameTo' => 'name_to',
    'valueTo' => '02-20-2012'
]);?>

Testing

To test the extension, is better to clone this repository on your computer. After, go to the extensions folder and do the following (assuming you have composer installed on your computer):

$ composer install --no-interaction --prefer-source --dev

Once all required libraries are installed then do:

$ vendor/bin/phpunit

I would recommend to have phpunit globally installed together with xdebug so you can have code coverage analysis too.

Further Information

Please, check the Bootstrap DatePicker site documentation for further information about its configuration options.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The BSD License (BSD). Please see License File for more information.

2amigOS!
Web development has never been so fun!
www.2amigos.us

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].