2017 © Pedro Peláez
 

yii2-extension yii2-datetimepicker

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

image

nkovacs/yii2-datetimepicker

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  • Tuesday, March 28, 2017
  • by nkovacs
  • Repository
  • 1 Watchers
  • 10 Stars
  • 21,387 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 0 Open issues
  • 17 Versions
  • 6 % Grown

The README.md

Datetime picker widget

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker., (*1)

Installation

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

Either run, (*3)

php composer.phar require --prefer-dist nkovacs/yii2-datetimepicker "*"

or add, (*4)

"nkovacs/yii2-datetimepicker": "*"

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

Usage

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

<?= \nkovacs\datetimepicker\DateTimePicker::widget([
    'name' => 'time',
]); ?>

or as an active field:, (*7)

<?= $form->field($model, 'time')->widget(\nkovacs\datetimepicker\DateTimePicker::className(), [
    'clientOptions' => [
        'extraFormats' => ['YYYY-MM-DD HH:mm'],
    ],
]) ?>

To show just a datepicker:, (*8)

<?= $form->field($model, 'time')->widget(\nkovacs\datetimepicker\DateTimePicker::className(), [
    'type' => 'date',
]) ?>

or just a timepicker:, (*9)

<?= $form->field($model, 'time')->widget(\nkovacs\datetimepicker\DateTimePicker::className(), [
    'type' => 'time',
]) ?>

The widget will load the moment locale file for Yii::$app->language if it can find it., (*10)

It will also use Yii::$app->formatter->dateFormat, Yii::$app->formatter->timeFormat or Yii::$app->formatter->datetimeFormat depending on type., (*11)

Use the timestampAttribute property of the validator in this extension to get the parsed timestamp., (*12)

Both can be overriden using the locale and format options., (*13)

Validators

The extension comes with an improved datetime validator. Yii's default DateValidator cannot handle time values with the default ICU 'medium' format. The validator adds a type option that specifies what kind of value should be accepted: date, time or datetime., (*14)

To register the validator, add the following line to your app config file:, (*15)

\nkovacs\datetimepicker\DateTimeValidator::register();

This replaces the built-in date validator and adds a time and datetime validator:, (*16)

    ...
    ['timestamp', 'datetime'],
    ['time', 'time'],
    ['date', 'date'],
    ...

The Versions

28/03 2017

dev-master

9999999-dev

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

28/03 2017

3.1.0

3.1.0.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

10/02 2016

2.x-dev

2.9999999.9999999.9999999-dev

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

10/02 2016

2.1.4

2.1.4.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

10/02 2016

3.0.3

3.0.3.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

24/08 2015

2.1.3

2.1.3.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

24/08 2015

3.0.2

3.0.2.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

03/07 2015

3.0.1

3.0.1.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

11/06 2015

dev-dev

dev-dev

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

11/06 2015

3.0.0

3.0.0.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

01/06 2015

2.1.2

2.1.2.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

22/03 2015

2.1.1

2.1.1.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

18/03 2015

2.1.0

2.1.0.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

18/03 2015

2.0.2

2.0.2.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

18/03 2015

2.0.1

2.0.1.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

18/03 2015

2.0.0

2.0.0.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker

13/10 2014

1.0.0

1.0.0.0

Bootstrap datetimepicker widget for Yii 2, based on Eonasdan/bootstrap-datetimepicker.

  Sources   Download

BSD-3-Clause

The Requires

 

by Nikola Kovacs

extension yii2 bootstrap datetimepicker