2017 © Pedro Peláez
 

yii2-extension yii2-widget-combodate

Wrapper of jQuery plugin Combodate (https://github.com/vitalets/combodate)

image

kovalenkojuls/yii2-widget-combodate

Wrapper of jQuery plugin Combodate (https://github.com/vitalets/combodate)

  • Sunday, September 11, 2016
  • by kovalenkojuls
  • Repository
  • 1 Watchers
  • 3 Stars
  • 376 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

yii2-widget-combodate

Wrapper of jQuery plugin Combodate (https://github.com/vitalets/combodate), (*1)

  • Simple Input
  • Many options
  • Many templates

Installation

The preferred way to install this extension is through composer. Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json., (*2)

To install, either run, (*3)

$ php composer.phar require kovalenkojuls/yii2-widget-combodate "*"

or add, (*4)

"kovalenkojuls/yii2-widget-combodate": "*"

to the require section of your composer.json file., (*5)

Demo

You can refer detailed demos, (*6)

Usage

use kovalenkojuls\date\CombodateWidget;

// usage without model
echo '<label>Check Date</label>';
echo CombodateWidget::widget([
    'name' => 'check_date', 
    'options' => [
               'language'       => 'ru',
               'data-format'    => 'DD.MM.YYYY',
               'data-template'  => 'D MMMM YYYY',
               'customClass'    => 'form-control'
           ]
]);

//.......................................................................

// usage model
$form = ActiveForm::begin();
echo $form->field($model, 'birthday')->widget(CombodateWidget::className(),
       [
           'value'   => $model->birthday ? $model->birthday : '',
           'options' => [
               'language'       => 'ru',
               'data-format'    => 'DD.MM.YYYY',
               'data-template'  => 'D MMMM YYYY',
               'customClass'    => 'form-control'
           ]
       ])

Required parameters

Name Type Example Description
language string 'ru', 'fr', 'en' All language look at yii2-widget-combodate/assets/js/moment/locale/
data-format string 'DD-MM-YYYY', 'DD-MM-YYYY HH:mm', 'DD-MM-YYYY h:mm a' In this format date is stored in original input.
data-template string 'D MMM YYYY', 'DD / MM / YYYY HH : mm' In this format dropdowns are displayed.
name (without model) string 'data-input' Name of input.
value (with model) string If data-format='DD-MM-YYYY', value='21-05-2016' (for example) Initial value.

Optional parameters

Name Type Default Description
value mixed null Initial value. Used as default value if not defined in .
minYear int 1970 Minimum value in years dropdown.
maxYear int 2015 Maximum value in years dropdown.
yearDescending bool true Years order.
minuteStep int 5 Step of values in minutes dropdown.
secondStep int 1 Step of values in seconds dropdown.
firstItem string 'empty' What is shown in first item of all dropdown. Can be empty|name|none.
errorClass string null Css class applied if date is incorrect, e.g. Feb, 31. If null dropdowns appears in red border.
customClass string null Css class applied to each dropdown.
roundTime bool true Whether to round minutes and seconds if step > 1.
smartDays bool false If true - number of days depends on selected month and year.

License

MIT LICENSE, (*7)

The Versions

11/09 2016

v1.0

1.0.0.0

Wrapper of jQuery plugin Combodate (https://github.com/vitalets/combodate)

  Sources   Download

by Julia Kovalenko

plugin extension yii2 jquery form date widget select2 picker

11/09 2016

dev-master

9999999-dev

Wrapper of jQuery plugin Combodate (https://github.com/vitalets/combodate)

  Sources   Download

https://github.com/kovalenkojuls/yii2-widget-combodate/blob/master/LICENSE.md

by Julia Kovalenko

plugin extension yii2 jquery form date widget select2 picker