2017 © Pedro Peláez
 

yii2-extension yii2-datetime-widget

Date/Time Picker widget for Yii2 framework

image

trntv/yii2-datetime-widget

Date/Time Picker widget for Yii2 framework

  • Saturday, March 17, 2018
  • by trntv
  • Repository
  • 3 Watchers
  • 4 Stars
  • 59,549 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 10 Forks
  • 6 Open issues
  • 7 Versions
  • 9 % Grown

The README.md

Yii2 Date/Time Picker Widget

Date/Time Picker widget for Yii2 framework Based on Eonasdan's Bootstrap 3 Date/Time Picker DateTimePicker, (*1)

Demo

Since this is a part of yii2-starter-kit it's demo can be found in starter kit demo here., (*2)

Login: webmaster
Password: webmaster

Before you start

Make sure you have fxp/composer-asset-plugin installed:, (*3)

composer global require fxp/composer-asset-plugin

Installation

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

Either run, (*5)

php composer.phar require trntv/yii2-datetime-widget

or add, (*6)

"trntv/yii2-datetime-widget": "*"

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

Usage

Once the extension is installed, simply use it in your code by :, (*8)

<?php echo $form->field($model, 'attribute')->widget(
        'trntv\yii\datetime\DateTimeWidget',
        [ ... options ... ]
    ); 
?>

Options

phpDatetimeFormat - PHP ICU datetime format (Default: dd.MM.yyyy, HH:mm), (*9)

momentDatetimeFormat - Moment JS datetime format (Default: DD.MM.YYYY, HH:mm), (*10)

showAddon - show or hide input-addon (Default: true), (*11)

addonContent - addon content, (*12)

phpMomentMapping - formats map (Default: true), (*13)

containerOptions - widget container optionsgit, (*14)

clientOptions - full list of available options, (*15)

*** Note: to enable widget show on textbox focus when used in a button group, use allowInputToggle option:, (*16)

...
'clientOptions' => [
    'allowInputToggle' => true
]
...

Examples

ActiveField input widget:, (*17)

<?php echo $form->field($model, 'datetime')->widget(
    'trntv\yii\datetime\DateTimeWidget',
    [
        'phpDatetimeFormat' => 'yyyy-MM-dd\'T\'HH:mm:ssZZZZZ',
        'clientOptions' => [
            'minDate' => new \yii\web\JsExpression('new Date("2015-01-01")'),
            'allowInputToggle' => false,
            'sideBySide' => true,
            'locale' => 'zh-cn',
            'widgetPositioning' => [
               'horizontal' => 'auto',
               'vertical' => 'auto'
            ]
        ]
    ]
]); ?>

Standalone widget for date only:, (*18)

<?php echo trntv\yii\datetime\DateTimeWidget::widget([
    'phpDatetimeFormat' => 'yyyy-MM-dd',
]) ; ?>

Add custom JS events:, (*19)

<?php echo trntv\yii\datetime\DateTimeWidget::widget([
    'clientEvents' => [
        'dp.change' => 'function(e){
            console.log('dp.change');
        }',
    ],
]) ; ?>

The Versions

17/03 2018

dev-master

9999999-dev

Date/Time Picker widget for Yii2 framework

  Sources   Download

GPL-3.0+

The Requires

  • yiisoft/yii2 ^2.0
  • bower-asset/eonasdan-bootstrap-datetimepicker ^4.17
  • bower-asset/moment ^2.21

 

extension yii2 bootstrap widget datetime picker

17/03 2018

1.1.0

1.1.0.0

Date/Time Picker widget for Yii2 framework

  Sources   Download

GPL-3.0+

The Requires

  • yiisoft/yii2 ^2.0
  • bower-asset/eonasdan-bootstrap-datetimepicker ^4.17
  • bower-asset/moment ^2.21

 

extension yii2 bootstrap widget datetime picker

12/02 2016

1.0.4

1.0.4.0

Date/Time Picker widget for Yii2 framework

  Sources   Download

GPL-3.0+

The Requires

 

extension yii2 bootstrap widget datetime picker

28/09 2015

1.0.3

1.0.3.0

Date/Time Picker widget for Yii2 framework

  Sources   Download

GPL-3.0+

The Requires

 

extension yii2 bootstrap widget datetime picker

18/09 2015

1.0.2

1.0.2.0

Date/Time Picker widget for Yii2 framework

  Sources   Download

GPL-3.0+

The Requires

 

extension yii2 bootstrap widget datetime picker

09/09 2015

1.0.1

1.0.1.0

Date/Time Picker widget for Yii2 framework

  Sources   Download

GPL-3.0+

The Requires

 

extension yii2 bootstrap widget datetime picker

09/09 2015

1.0.0

1.0.0.0

Date/Time Picker widget for Yii2 framework

  Sources   Download

GPL-3.0+

The Requires

 

extension yii2 bootstrap widget datetime picker