I have enabled/used the date picker from materializecss.com in my google script. I want to add a limit so that if a certain date is selected, for example, 10 times (e.g. 10 users selected the same date), it will disable the date selection.
I have placed the code for HTML for date picker which I got from materialize CSS. Then I also copy-paste the initialization indicated in the materialize CSS website under form then, picker and add some other codes.
for html:
<!-- DATE SELECTION -->
<div class="row">
<div class="input-field col s4">
<input id="subDate" type="text" class="datepicker" required>
<label for="subDate">Select Date</label>
</div> <!-- CLOSE TIME FIELD -->
</div>
for javascript:
document.addEventListener('DOMContentLoaded', function() {
//FOR DATE SELECTION
var dateSelect = document.getElementById('subDate');
// ----------- Setting Dates to Disable ------------
var disabledDays = [
new Date("2019, 11, 01").valueOf(),
new Date("2019, 7, 18").valueOf()
];
M.Datepicker.init(dateSelect, {
minDate: new Date ("2019, 5, 10"),
maxDate: new Date ("2019, 8, 21"),
format: 'mmmm dd, yyyy',
disableWeekends: true,
disableDayFn: function(day){
return disabledDays.indexOf(day.valueOf()) > -1;
}
});
});
For now, I can select or pick dates but I don't know how to code for the limit. Thank you in advance for the help. I'm a newbie when it comes to programming.