如何添加日期yii2?当我输入签到和哈里时,结帐中的值=签到+哈里。你能帮助我吗?谢谢。
这是我在 yii2 中的代码,如果日期选择器 tanggal_masuk 和一个字段 jumlah_hari 输入数据,那么日期选择器 = tanggal_masuk+jumlah_hari
<?= DatePicker::widget([
'model' => $model,
'attribute' => 'TANGGAL_MASUK',
'template' => '{addon}{input}',
'clientOptions' => [
'autoclose' => true,
'format' => 'dd-M-yy',
'startDate' => date('d-M-y'),
'prepend' => '<i class="icon-calendar"></i>'
]
]);?>
<?php $data =
['1' => '1 Malam',
'2' => '2 Malam',
'3' => '3 Malam',
'4' => '4 Malam',
'5' => '5 Malam',
'6' => '6 Malam',
'7' => '7 Malam',
'8' => '8 Malam',
'9' => '9 Malam',
'10' => '10 Malam',
'11' => '11 Malam',
'12' => '12 Malam',
'13' => '13 Malam',
'14' => '14 Malam',
'15' => '15 Malam']; ?>
<?= $form->field($model, 'JUMLAH_HARI')->widget(Select2::classname(), [
'data' => $data,
'language' => 'en',
'options' => ['placeholder' => 'Hari'],
'pluginOptions' => [
'allowClear' => true
],
]); ?>
<font size="2"><b>Check-Out</b></font>
<?= DatePicker::widget([
'model' => $model,
'attribute' => 'TANGGAL_KELUAR',
'template' => '{addon}{input}',
'clientOptions' => [
'autoclose' => true,
'format' => 'dd-M-yy',
'startDate' => date('d-M-y'),
'prepend' => '<i class="icon-calendar"></i>'
]
]);?>