Literally, moment().add() is not working in my js code.
var theDate = moment(event.start.format("YYYY-MM-DD HH:mm")); //start Date of event
var checkquarter = theDate.add(30, 'minutes');
var plus = 30;
if (userDuration == '45') {
plus = 45;
}
for (var i = 0; i < excludedList.length; i++) {
var excludedTomorrow = moment(excludedList[i]["excludedDate"]).format("YYYY-MM-DD HH:mm"); //start Date of event that should be excluded
var endtime = moment(excludedTomorrow).add(plus, 'minutes'); //endTime of event that should be excluded
if (excludedList[i]["id"] == 'aaa@gmail.com') {
console.log(endtime);
console.log(plus);
console.log(theDate);
console.log(checkquarter);
}
//var endtimeForCompare = moment(endtime);
if (theDate >= excludedTomorrow && theDate < endtime && Id == excludedList[i]["id"]) {
return false;
}
}
<script src='https://momentjs.com/downloads/moment.js'></script>
See Question&Answers more detail:os