for (let index = 0; index < $(".hour").length; index++) {
console.log("test");
var hour = moment().hour(9).format("h");
$(".row").find(`[data-hour]`).text(hour);
}
This posts 9 in my first div. I would like my next dive to post 10 etc... I can't figure out how to increment my moment.
image linked of what it looks like in browser
Option 1:
for (let index = 0; index < $(".hour").length; index++) {
console.log("test");
var hour = moment().hour(index).format("h");
$(".row").find(`[data-hour]`).text(hour);
}
Option 2: (Probably more performant)
let myMoment = moment();
for (let index = 0; index < $(".hour").length; index++) {
console.log("test");
var hour = myMoment.hour(index).format("h");
myMoment.add(1, 'h');
$(".row").find(`[data-hour]`).text(hour);
}