gijgo icon indicating copy to clipboard operation
gijgo copied to clipboard

How to set a minDate after initialization?.

Open maheshKDS opened this issue 7 years ago • 1 comments

I have two datepicker date 'StartDate' and 'EndDate' , when I choose a date from 'StartDate' it's automatically minDate to 'EndDate'

$('#StartDate').datepicker({ uiLibrary: 'bootstrap', format: 'dd-mmm-yyyy', minDate: new Date() });

$('#EndDate').datepicker({ uiLibrary: 'bootstrap', format: 'dd-mmm-yyyy' });


i try some solution on 'startDate' select event

  1. $("#EndDate").datepicker({ minDate: new Date() })
  2. $('#EndDate').datepicker('option', 'minDate', $('#StartDate').datepicker('getDate'));

I got an error: 'Uncaught Method getDate does not exist.'

maheshKDS avatar Aug 30 '18 14:08 maheshKDS

@maheshKDS you can achieve it with:

var datePickerConfig = {
    minDate: () => $('#StartDate').val() || new Date()
}

fatkhanfauzi avatar Dec 10 '20 14:12 fatkhanfauzi