2017 © Pedro Peláez
 

yii2-extension yii2-datetime-widget

Date/Time Picker widget for Yii2 framework

image

shirase55/yii2-datetime-widget

Date/Time Picker widget for Yii2 framework

  • Monday, February 6, 2017
  • by shirase
  • Repository
  • 1 Watchers
  • 0 Stars
  • 396 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 10 Forks
  • 0 Open issues
  • 7 Versions
  • 3 % 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 shirase55/yii2-datetime-widget

or add, (*6)

"shirase55/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(
        'shirase55\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(
    'shirase55\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 shirase55\yii\datetime\DateTimeWidget::widget([
    'phpDatetimeFormat' => 'yyyy-MM-dd',
]) ; ?>

Add custom JS events:, (*19)

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

The Versions

06/02 2017

dev-master

9999999-dev

Date/Time Picker widget for Yii2 framework

  Sources   Download

GPL-3.0+

The Requires

 

extension yii2 bootstrap widget datetime picker

17/05 2016

1.0.5

1.0.5.0

Date/Time Picker widget for Yii2 framework

  Sources   Download

GPL-3.0+

The Requires

 

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