How could I make a calendar? [closed]

javascript date object is pretty handy. You can do something like this to get current dates of the current month:

const today = new Date()
const date = new Date()
date.setDate(1)
var calendar=""
for(var i = 0; i < 31; i++) {
  if(date.getMonth() == today.getMonth()) {
    calendar += `<div onclick="openModal()">${date.getDate()}</div> `
  }
}

This is just a small piece of code to point you to the right direction.

Leave a Comment