I am using jQuery datepicker. In my application, I have startDate
and endDate
date ranges.
If my date range is less than a week(7 days), I need to disable some day textbox's. Please see the image below
I can able to get the number of days difference between to dates like this;
var startDate = $('#startDate').datepicker('getDate');
var endDate = $('#endDate').datepicker('getDate');
//find difference between start and end date
var noOfDays = Math.ceil((startDate - startDate) / (1000 * 60 * 60 * 24));
If noOfDays
is less than 7 days, I need to disable the day textbox according to the date range. For that I need list days between date ranges.
According to my example image Mon
and Sun
should be disabled.
['Tue','Wed','Thu','Fri','Sat']
or corresponding UTC day values ['1','2','3','4','5']
should be enabled.
Can anyone guide me to get day values?
Try this : month is start from 0.