This is thai buddhist calendar datetimepicker of Yii2 extension.
modified from https://code.google.com/archive/p/jquery-ui-datepicker-extension-buddhist-era/
by sorajate@gmail.com, (*1)
created by wattanapong suttapak
email me wattanapong.su@up.ac.th, (*2)
This version 1.0.0
It's completed version of datetimepicker work on jquery-ui less than version 1.9 .
This version support datepicker and datetimepicker via Datetimepicker::Classname, (*3)
## Installation
To install, either run, (*4)
$ composer require wattanapong/yii2-widget-datetimepicker "@dev", (*5)
or add, (*6)
"wattanapong/yii2-widget-datetimepicker" : "@dev", (*7)
Usage
All of usage base on jquery-ui, (*8)
DateTimePicker
use wattanapong\datetime\DateTimePicker;
// usage without model
echo '<label>Check Issue Date</label>';
echo DateTimePicker::widget([
'name' => 'attributename',
'value' => date('d M Y', strtotime('+2 days')),
'options' => ['placeholder' => 'Select date ...'],
'pluginOptions' => [
'format' => 'dd-M-yyyy',
'todayHighlight' => true,
'isBE' => true,
'timeFormat' => 'hh:mm:ss',
'buttonImageOnly'=> true,
'maxDate' => date('d M Y',strtotime('+2 days')),
'minDate' => date('d M Y',strtotime('-10 days')),
]
]);
// usage with model
= $form->field($model, 'attributename')->widget(DateTimePicker::className(),
[
'dateFormat' => 'php:d M yy',
'isDateTime' => false,
'name' => 'attributename',
'value' => date('d M Y', strtotime('+2 days')),
'options' => ['class'=>'form-control','placeholder' => 'Select date ...'],
'pluginOptions' =>[
'isBE' => true,
'timeFormat' => 'hh:mm:ss',
'buttonImageOnly'=> true,
'maxDate' => date('d M Y',strtotime('+2 days')),
'minDate' => date('d M Y',strtotime('-10 days')),
]
]
)?>
DateTimePicker with DateRange
cannot use inline option, (*9)
use wattanapong\datetime\DateTimePicker;
// usage without model
echo '<label>Check Issue Date</label>';
echo DateTimePicker::widget([
//'model' => $modelTrainingCourse,
'from' => 'trainingdate',
'value' => date('d M Y'),
'to' => 'trainingend',
'valueTo' => date('d M Y', strtotime('+2 days')),
'dateFormat' => 'php:d M yy',
'isDateTime' => true,
//'separate' => 'To',
'options' => ['class'=>'form-control','placeholder' => 'Select date ...'],
'pluginOptions' =>[
'isBE' => true,
'timeFormat' => 'hh:mm:ss',
'showButtonPanel' => true,
'maxDate' => date('d M Y'),
'minDate' => date('d M Y',strtotime('-10 days')),
'maxDateTo' => date('d M Y',strtotime('+30 days')),
'minDateTo' => date('d M Y',strtotime('-10 days')),
]
]);