kartik-v/yii2-widget-datetimepicker Enhanced Yii2 wrapper for the bootstrap datetimepicker plugin (sub repo split from yii2-widgets)


Krajee Logo
yii2-widget-datetimepicker Donate       kartikv

[![Stable Version](https://poser.pugx.org/kartik-v/yii2-widget-datetimepicker/v/stable)](https://packagist.org/packages/kartik-v/yii2-widget-datetimepicker) [![Untable Version](https://poser.pugx.org/kartik-v/yii2-widget-datetimepicker/v/unstable)](https://packagist.org/packages/kartik-v/yii2-widget-datetimepicker) [![License](https://poser.pugx.org/kartik-v/yii2-widget-datetimepicker/license)](https://packagist.org/packages/kartik-v/yii2-widget-datetimepicker) [![Total Downloads](https://poser.pugx.org/kartik-v/yii2-widget-datetimepicker/downloads)](https://packagist.org/packages/kartik-v/yii2-widget-datetimepicker) [![Monthly Downloads](https://poser.pugx.org/kartik-v/yii2-widget-datetimepicker/d/monthly)](https://packagist.org/packages/kartik-v/yii2-widget-datetimepicker) [![Daily Downloads](https://poser.pugx.org/kartik-v/yii2-widget-datetimepicker/d/daily)](https://packagist.org/packages/kartik-v/yii2-widget-datetimepicker)

The DateTimePicker widget is a Yii 2 wrapper for the Bootstrap DateTimePicker plugin with various enhancements. The plugin is a fork of the DateTimePicker plugin by @eternicode and adds the time functionality. The widget is similar to the DateTimePicker widget in most aspects, except that it adds the time functionality and does not support ranges. The widget is specially styled for Yii framework 2.0 and Bootstrap 3 and allows graceful degradation to a normal HTML text input, if the browser does not support JQuery. The widget supports these markups:

  • Simple Input Markup
  • Component Markup - Addon Prepended
  • Component Markup - Addon Appended
  • Inline / Embedded Markup
  • Solo Button Markup

NOTE: This extension is a sub repo split of yii2-widgets. The split has been done since 08-Nov-2014 to allow developers to install this specific widget in isolation if needed. One can also use the extension the previous way with the whole suite of yii2-widgets.


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.

To install, either run

$ php composer.phar require kartik-v/yii2-widget-datetimepicker "*"

or add

"kartik-v/yii2-widget-datetimepicker": "*"

to the require section of your composer.json file.

Release Changes

NOTE: Refer the CHANGE LOG for details on changes to various releases.


You can refer detailed documentation and demos and API Documentation on usage of the extension.


use kartik\datetime\DateTimePicker;

echo '<label>Start Date/Time</label>';
echo DateTimePicker::widget([
    'name' => 'datetime_10',
    'options' => ['placeholder' => 'Select operating time ...'],
    'convertFormat' => true,
    'pluginOptions' => [
        'format' => 'd-M-Y g:i A',
        'startDate' => '01-Mar-2014 12:00 AM',
        'todayHighlight' => true


yii2-widget-datetimepicker is released under the BSD-3-Clause License. See the bundled LICENSE.md for details.


Change Log: yii2-widget-datetimepicker

Version 1.5.1

Date: 18-Mar-2022

  • Updates for new bootstrap 5.x dependencies.

Version 1.5.0

Date: 28-Oct-2021

  • Enhancements to support Bootstrap v5.x.

Version 1.4.9

Date: 29-May-2019

  • (enh #103): Improve layout for TYPE_BUTTON.
  • (enh #102): Update Portuguese Brazil Translations.
  • (bug #91): Enhance date time picker plugin for button type input update.
  • (enh #35): Allow picker button to be set as false for append/prepend.
  • Implement stale bot.

Version 1.4.8

Date: 09-Oct-2018

  • Bump composer dependencies.

Version 1.4.7

Date: 29-Aug-2018

  • (bug #97): Correct input clear/reset after click.
  • Correct Asset Bundle registration to validate bsVersion.

Version 1.4.6

Date: 25-Aug-2018

  • (bug #96): Correct JS language locale translations.

Version 1.4.5

Date: 22-Aug-2018

  • Add Bootstrap 4.x support.
  • Reorganize source code in src directory.
  • (enh #94): Add Kazakh Translations.
  • (enh #92): Update bootstrap-datetimepicker.js plugin to support Bootstrap 4.x.
  • (enh #86): Update Turkish translations.

Version 1.4.4

Date: 08-Jun-2017

  • (enh #82, #81): Update German Translations.
  • (enh #78): Update Russian Translations.
  • (bug #70, #71): Rollback release of bootstrap-datetimepicker plugin.
  • (enh #66, #68, #72, #73, #74, #75): Timezone defaulting enhancements and bug fixes for datetimepicker.

Version 1.4.3

Date: 19-Jan-2017

  • (enh #65): Add Gujarati and Hindi Translations.
  • (enh #62): Add French Translations.
  • (enh #61): Add Japanese Translations.
  • (enh #58): Add Portuguese Translations.
  • (enh #56): Add Thai Translations.
  • (enh #55): Add Czech Translations.
  • (enh #54): Add Slovak Translations.
  • (enh #51): Update to latest release of the bootstrap-datetimepicker plugin.
  • Add github contribution and issue/PR log templates.
  • Update message config to include all default standard translation files.

Version 1.4.2

Date: 10-Jan-2016

  • (enh #50): Enhancements for PJAX based reinitialization. Complements enhancements in kartik-v/yii2-krajee-base#52 and kartik-v/yii2-krajee-base#53.
  • (enh #49): Correct Italian Translation file name.
  • (enh #48): Add Swedish translations.
  • (enh #47): Add Italian translations.
  • (enh #43): Add Hungarian Translations.
  • (enh #42): Add Traditional Chinese Translations.

Version 1.4.1

Date: 05-Nov-2015

  • (enh #40): Add Spanish ES translations.
  • (enh #36): Add 'meridiem' and 'sufix' properties to UA locale.
  • (enh #34): New property layout to control rendering of picker and remove buttons.
  • (enh #30): Added Polish Translations.
  • (enh #33): Rename translations message category to kvdtime.
  • (enh #32): Update to latest stable release of bootstrap-datetimepicker plugin.
  • (enh #24): Added Chinese Translations.
  • (enh #20): Added Ukranian Translations.
  • (enh #18): Added Dutch Translations.
  • (bug #17): Remove BOM symbol in Russian translations.
  • (enh #16): Improve validation to retrieve the right translation messages folder.
  • (enh #14): Russian translations updated.

Version 1.4.0

Date: 25-Jan-2015

  • (bug #12): Fix directory separator for assets path in setLanguage.

Version 1.3.0

Date: 12-Jan-2015

  • Revamp to use new Krajee base InputWidget and TranslationTrait.
  • Code formatting updates as per Yii2 standards.
  • (enh #10): German translations added.
  • (enh #9): Set i18N translation settings for 'kvdatetime' message category.
  • (enh #8): Create locale bootstrap-datetimepicker.tj.js

Version 1.2.0

Date: 04-Dec-2014

  • (enh #6): Include styling of markup rightly based on type for disabled and readonly
  • (enh #5): Auto validate disability using new disabled and readonly properties in InputWidget
  • (enh #4): Add a new markup TYPE_BUTTON with hidden input.
  • (bug #3): Fix setLanguage asset locales registration.
  • (bug #2): Ensure DateTimePicker minified javascript is of correct version

Version 1.1.0

Date: 29-Nov-2014

  • (enh #1): Enhance language locale file parsing and registering

Version 1.0.0

Date: 08-Nov-2014


GitHub Stars
GitHub Forks



v1.5.1 is the latest of 16 releases

BSD-3-Clause license
106 github stars & 54 github forks
740 downloads in the last day
60682 downloads in the last 30 days
4714563 total downloads