2amigos / yii2-date-time-picker-widget

Bootstrap DateTimePicker Widget for Yii2
Other
44 stars 35 forks source link

Date formatting not working #5

Closed pkjoshi closed 7 years ago

pkjoshi commented 9 years ago

1.I am using the extension and provided the formatting for dates, but it is not picking up the format provided. The output date shown in the field is yyyy-MM-dd

  1. Also before picking any date the field is blank and set to Null value, but I can't find a way of not selecting any date, once the date is selected. Means on edit at times I want no date at all. How this can be done?

here is my code:

$form->field($model, 'admission_date')->widget(DateTimePicker::className(), [
            'language' => 'en',             
            'size' => 'ms',
            'template' => '{input}',
            'pickButtonIcon' => 'glyphicon glyphicon-time',           
            'clientOptions' => [
                'startView' => 2,
                'minView' => 0,
                'maxView' => 1,
                'autoclose' => true,              
                'format' => 'dd-MM-yyyy HH:ii P', // if inline = false             
                'todayBtn' => true
            ]
            ])->label('Admission Date & Time')