2017 © Pedro Peláez
 

yii2-extension yii2-date-picker-widget

Bootstrap DatePicker widget for Yii2.

image

2amigos/yii2-date-picker-widget

Bootstrap DatePicker widget for Yii2.

  • Wednesday, July 5, 2017
  • by tonydspaniard
  • Repository
  • 21 Watchers
  • 117 Stars
  • 251,157 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 77 Forks
  • 13 Open issues
  • 10 Versions
  • 7 % Grown

The README.md

Bootstrap DatePicker Widget for Yii2

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads, (*1)

Renders a Bootstrap DatePicker plugin., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

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

or add, (*5)

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

to the require section of your application's composer.json file., (*6)

Usage

The widget comes in two flavors:, (*7)

  • DatePicker
  • DateRangePicker

DatePicker, (*8)

This widget renders a Bootstrap DatePicker input control. Best suitable for model with date string attribute., (*9)

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., (*10)



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


= $form->field($model, 'date')->widget(
    DatePicker::className(), [
        // inline too, not bad
         'inline' => true, 
         // modify template for custom rendering
        'template' => '
{input}
', 'clientOptions' => [ 'autoclose' => true, 'format' => 'dd-M-yyyy' ] ]);?>

Example of use without a model, (*11)

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

DateRangePicker, (*12)

This widget renders a Bootstrap DateRangePicker Input control., (*13)

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

<?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, (*15)

<?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):, (*16)

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

Once all required libraries are installed then do:, (*17)

$ vendor/bin/phpunit

I would recommend to have phpunit globally installed together with xdebug so you can have code coverage analysis too., (*18)

Further Information

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

Contributing

Please see CONTRIBUTING for details., (*20)

Credits

License

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

2amigOS!
Web development has never been so fun!
www.2amigos.us, (*22)

The Versions

05/07 2017

dev-master

9999999-dev http://yiiwheels.com/extension/bootstrap-datepicker

Bootstrap DatePicker widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget datepicker

05/07 2017

1.0.7

1.0.7.0 http://yiiwheels.com/extension/bootstrap-datepicker

Bootstrap DatePicker widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget datepicker

14/03 2017

1.0.6

1.0.6.0 http://yiiwheels.com/extension/bootstrap-datepicker

Bootstrap DatePicker widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget datepicker

02/04 2015

1.0.5

1.0.5.0 http://yiiwheels.com/extension/bootstrap-datepicker

Bootstrap DatePicker widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget datepicker

23/03 2015

1.0.4

1.0.4.0 http://yiiwheels.com/extension/bootstrap-datepicker

Bootstrap DatePicker widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget datepicker

22/03 2015

1.0.3

1.0.3.0 http://yiiwheels.com/extension/bootstrap-datepicker

Bootstrap DatePicker widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget datepicker

20/03 2015

1.0.2

1.0.2.0 http://yiiwheels.com/extension/bootstrap-datepicker

Bootstrap DatePicker widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget datepicker

20/03 2015

1.0.1

1.0.1.0 http://yiiwheels.com/extension/bootstrap-datepicker

Bootstrap DatePicker widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget datepicker

17/03 2015

1.0.0

1.0.0.0 http://yiiwheels.com/extension/bootstrap-datepicker-widget

Bootstrap DatePicker widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget datepicker

03/04 2014

0.1.0

0.1.0.0

Bootstrap DatePicker widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii widget datepicker