function Scheduler(){
var t = this;
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth();
const day = document.querySelector(".calendar-dates");
const currdate = document
.querySelector(".calendar-current-date");
const prenexIcons = document
.querySelectorAll(".calendar-navigation span");
// Array of month names
const months = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
// Function to generate the calendar
const manipulate = () => {
// Get the first day of the month
let dayone = new Date(year, month, 1).getDay();
// Get the last date of the month
let lastdate = new Date(year, month + 1, 0).getDate();
// Get the day of the last date of the month
let dayend = new Date(year, month, lastdate).getDay();
// Get the last date of the previous month
let monthlastdate = new Date(year, month, 0).getDate();
// Variable to store the generated calendar HTML
let lit = "";
// Loop to add the last dates of the previous month
for (let i = dayone; i > 0; i--) {
lit +=
`<li class="inactive"><span>${monthlastdate - i + 1}</span></li>`;
}
// Loop to add the dates of the current month
for (let i = 1; i <= lastdate; i++) {
// Check if the current date is today
let isToday = i === date.getDate()
&& month === new Date().getMonth()
&& year === new Date().getFullYear()
? "active"
: "";
let rm = parseInt(month+1) + '';
let rd = i + '';
let timestamp = year + '-' + rm.padStart(2, '0') + '-' + rd.padStart(2, '0');
lit += `<li class="${isToday}" data-timestamp="${timestamp}"><span>${i}</span></li>`;
}
// Loop to add the...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.