Answer the question
In order to leave comments, you need to log in
What is wrong with datatime?
To form the date I use kartik-v yii2-widget-datepicker here is the repository
for tz there was a condition if the date is not filled then display '00-00-0000' in editing.
for this I did this in the form
form->field($model, 'date')->textInput()->widget(DatePicker::class, [
'options' => [
'placeholder' => 'Enter birth date ...',
'value'=>($model->date)?date('d-m-Y',strtotime($model->date)):null,
],
'pluginOptions' => [
'autoclose'=>true,
'format' => 'dd-mm-yyyy'
]
]);
'value'=>($model->date)?date('d-m-Y',strtotime($model->date)):null,
Answer the question
In order to leave comments, you need to log in
As I understand it, you need to change not only value, but also the date
format
. So I think you need to take jquery, hook on the initialization event, and if there is "tinny output", replace it with the desired string bypassing the widget
Or take a widget with support for choosing an empty date option.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question