From the html I made with date picker, if a date was selected and submitted, it\'s output will be saved in the Google Sheet.
Here is the sample output:
August 20, 2019
, July 26, 2019
, July 19, 2019
and the weekends.If my understanding is correct, how about this modification? Please think of this as just one of several answers.
Please modify the function of populateDates()
of HTML & Javascript side as follows.
function populateDates(disabledDays){
var dateSelect = document.getElementById('subDate');
M.Datepicker.init(dateSelect, {
minDate: new Date ("2019, 5, 10"),
maxDate: new Date ("2019, 8, 21"),
disableWeekends: true,
disableDayFn: function(day){ // Modified
return disabledDays.some(e => {
var obj = new Date(e);
return obj.getFullYear() == day.getFullYear() && obj.getMonth() == day.getMonth() && obj.getDate() == day.getDate();
});
}
});
}
disabledDays
from revealDates()
of Google Apps Script are the string values. So the string values are converted to the date object at the script of disabledDays = disabledDays.map(e => new Date(e))
.