I am building a day calendar. It has 8 boxes each representing an hour. I would like the the boxes in the past greyed out using moment. What I am thinking so far is this here:
var greyedOut = ["nine", "ten", "eleven", "twelve", "thirteen", "fourteen",
"fifteen", "sixteen", "seventeen"
]
var selected = [];
greyedOut.forEach(function(check) {
selected.push(check)
})
console.log(selected);
if (moment().isAfter(moment(check))) {
$()
};
var check = moment.duration(8, 'hours').asMinutes();
console.log(check);
let divvy = [480 / 8, 60 / 8];
console.log(divvy);
Thank you for any input or advice
Your question isn't very clear, but maybe this is close to what you want.
greyedOut.forEach(function(check) {
if (moment().isAfter(moment(check))) {
$("#" + check).css("background-color", "grey");
} else {
selected.push(check);
}
});
console.log(selected);
The test of moment(check) needs to be inside the loop.