Yii 1.1: juidatetimepicker

DateTime picker with localization's support and current time instead zero in picker
14 followers

EJuiDateTimePicker input widget, based on Timepicker Addon Version 1.0.4 extends CJuiDatePicker

In box: support localization's (i18n), compressed JS if not YII_DEBUG (min.js).

Also, the default is the current time in picker, instead of the zero time (the widget feature).

Requirements

Yii 1.1 or above

Install

Put files (assets, EJuiDateTimePicker.php) into /protected/extensions/jui

Usage

$this->widget(
    'ext.jui.EJuiDateTimePicker',
    array(
        'model'     => $model,
        'attribute' => 'publish_time',
        //'language'=> 'ru',//default Yii::app()->language
        //'mode'    => 'datetime',//'datetime' or 'time' ('datetime' default)
        'options'   => array(
            //'dateFormat' => 'dd.mm.yy',
            //'timeFormat' => '',//'hh:mm tt' default
        ),
    )
);

Resources

Download latest version from github

Total 5 comments

#16637 report it
Fen1kz at 2014/03/13 01:29pm
jQuery.datetimepicker is undefined

for some reason default mode is datetime and defaultOptions doesnt work becuase $.datetimepicker is undefined

idk, prolly im going to have separate default option for timepicker and datepicker oO

#12627 report it
fad at 2013/04/02 06:21am
lang update

fixed in github

$this->language = substr(Yii::app()->getLanguage(), 0, 2);
#12617 report it
lgastmans at 2013/04/01 09:09pm
default language bug?

the following option:

'language'=> default Yii::app()->language

shows Chinese characters in the datetime picker popup, even though language is set to 'en_us'. I had to change the line to

'language'=> 'en',
#10368 report it
janisto at 2012/10/23 08:19am
Minor bug.

If you are using other language and you have time and datetime field in the same page, only time picker is displayed in datetime.

Quick fix (EJuiDateTimePicker.php, line 106)

find:

$js = "jQuery('#{$id}').{$this->mode}picker(jQuery.extend(jQuery.datepicker.regional['{$this->language}'], {$options}));";

replace:

$cs->registerScript(__CLASS__ . '#i18n-' . $this->language, "jQuery.datepicker.setDefaults(jQuery.datepicker.regional['{$this->language}']);");
#10137 report it
cnick79 at 2012/10/06 03:04pm
assests not found

Maybe I'm doing something wrong, but when I try to use this plugin my app cannot find

mydomain.com/assets/118336d8/localization/jquery-ui-timepicker-en_us.js"

My app is installed under webroot/yii/app/. I used the CJuiDateTimePicker extension and that didn't have any problems.

EDIT: It appears I needed to set 'language'=>'en' in this widget.

Leave a comment

Please to leave your comment.

Create extension