I am using Yii bootstraps datepickerRow : Check this
I want my end_date depending on start_date. i.e. end_date should be greater than start date. I've spent couple of hours on google to check whether any in-built solution available for it but didn't found any solution. Then after I written my own js code which's I think perfectly fine but its not working.
I've already achieved this thing with Cjuidatepicker and its booming.
Check my working code for yii cjuidatepicker
But I don't know why its not working for yii bootstrap datepickerRow.
Any help would be appreciated.
Following is my code:
<?php
echo $form->datepickerRow(
$identitycard, 'date_of_issue', array(
'onChange' => 'setEndDate("passport_date_of_expiry", this)',
'class' => "input-small",
'labelOptions' => array('label' => 'Date of Issue <span class="required">*</span>'),
'value' => $passportArr['date_of_issue'],
'name' => 'passport[date_of_issue]',
'readonly' => true,
'options' => array(
'autoclose' => true,
'showAnim' => 'fold',
'format' => 'yyyy-mm-dd',
'endDate' => '-infinity'
),
'prepend' => '<i class="icon icon-calendar"></i>',
'hint' => 'yyyy-mm-dd'
)
);
echo $form->datepickerRow(
$identitycard, 'date_of_expiry', array(
'class' => "input-small",
'labelOptions' => array('label' => 'Date of Expiry <span class="required">*</span>'),
'value' => $passportArr['date_of_expiry'],
'name' => 'passport[date_of_expiry]',
'readonly' => true,
'options' => array(
'autoclose' => true,
'showAnim' => 'fold',
'format' => 'yyyy-mm-dd',
),
'prepend' => '<i class="icon icon-calendar"></i>',
'hint' => 'yyyy-mm-dd'
)
);
?>
// JS code
function setEndDate(id, date) {
var selectedDate = $(date).val();
$("#" + id).datepicker({
startDate: selectedDate,
format: "yyyy-mm-dd"
});
}