BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
<script>
function disableDate(args) {
if (+args.date == +new Date("04/18/2021")) {
args.isDisabled = true;
}
}
</script> |
<ejs-calendar id="calendar" renderDayCell="disableDate" value="@ViewBag.value"></ejs-calendar>
<script>
var allDates = [new Date("03/01/2021"), new Date("03/12/2021"), new Date("03/25/2021"), new Date("03/14/2021"), new Date("03/19/2021")];
function disableDate(args) {
for (t = 0; t < allDates.length; t++) {
if (+args.date == +new Date(allDates[t])) {
args.isDisabled = true;
}
}
}
</script>
|
var calendarObj;
var modelAvailables = [
{ "id": "47wkcvan239d86z14n9sy2ckxe", "subject": "Rezervováno", "status": "Rezervace", "startTime": "2021-03-16T15:30:00Z", "endTime": "2021-03-19T10:30:00Z", "isAllDay": true, "isBlock": true, "caravanId": "4b840er4bw4qx6r02jd9bvprw2", "caravanLocalizationSet": "4vk0np414kb6e227jejnrkarwc", "color": "rgba(230, 126, 34, 1)" },
{ "id": "4ksfmxnzzrwe3t27a6tk29gvxa", "subject": "Půjčené", "status": "Půjčeno", "startTime": "2021-03-13T08:30:00Z", "endTime": "2021-03-14T13:00:00Z", "isAllDay": true, "isBlock": true, "caravanId": "496rm1jt40ytjxzwy8hf328cm0", "caravanLocalizationSet": "4vk0np414kb6e227jejnrkarwc", "color": "rgba(207, 0, 15, 1)" },
{ "id": "4za92j0d0ptqkw1yn8y1fsk3ny", "subject": "Půjčené", "status": "Půjčeno", "startTime": "2021-03-08T08:00:00Z", "endTime": "2021-03-11T16:00:00Z", "isAllDay": true, "isBlock": true, "caravanId": "496rm1jt40ytjxzwy8hf328cm0", "caravanLocalizationSet": "4vk0np414kb6e227jejnrkarwc", "color": "rgba(207, 0, 15, 1)" }
];
/* var modelAvailables;*/
var allDates = [];
function availableDates() {
calendarObj = document.getElementById("calendar").ej2_instances[0];
var i;
var d;
for (i in modelAvailables) {
const startDatum = new Date(modelAvailables[i].startTime);
const endDatum = new Date(modelAvailables[i].endTime);
allDates.push(calendarObj.globalize.formatDate(startDatum, { format: "MM/dd/yyyy" })); // used to format the data object to particular date format
allDates.push(calendarObj.globalize.formatDate(endDatum, { format: "MM/dd/yyyy" }));// used to format the data object to particular date format
}
}
function disableDates(args) {
availableDates();
for (t = 0; t < allDates.length; t++) {
if (+args.date == +new Date(allDates[t])) {
args.isDisabled = true;
}
}
} |