Skip to content

Instantly share code, notes, and snippets.

View wrightwriter's full-sized avatar
:shipit:
writing singletons

Petar Guglev wrightwriter

:shipit:
writing singletons
View GitHub Profile
@wrightwriter
wrightwriter / genCal.js
Created February 16, 2019 12:25
Function to generate a dynamic sorted calendar object in JavaScript.
function makeCalendar(startYear, endYear) {
let calendar = {};
var dateA = new Date(startYear, 6, 1, 0, 0, 0);
var dateB = new Date(endYear, 6, 36, 0, 0, 0);
for (
var myDate = dateA;
myDate <= dateB;
myDate = new Date(myDate.getTime() + 1000 * 60 * 60 * 24)