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
),
)
);
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.
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}']);");
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',
lang update
fixed in github
$this->language = substr(Yii::app()->getLanguage(), 0, 2);
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
time not working
the widget displays date only, but not time. I even tried with 'mode' => 'time' but it doesn't work
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.