Skip to content

Instantly share code, notes, and snippets.

@enricopolanski
Created December 28, 2017 12:42
Show Gist options
  • Save enricopolanski/2726f4b3beae89a028423113eb51f948 to your computer and use it in GitHub Desktop.
Save enricopolanski/2726f4b3beae89a028423113eb51f948 to your computer and use it in GitHub Desktop.
function InitPlan() {
// gets the date of monday of the current week
this.startingWeek = function() {
let now = new Date();
now.setDate(now.getDate() - now.getDay() + 1);
return (now.getDate() + "-" + (now.getMonth() + 1) + "-" + now.getFullYear());
}();
this.weeks = {
"0": {
"mon": [],
"tue": [],
"wed": [],
"thu": [],
"fri": [],
"sat": [],
"sun": []
}
};
this.topics = {};
this.addTopic = function(topic) {
// checks if topic exists
if (topic in this.topics) {
console.log("This topic already exists!");
return;
} else {
this.topics = topic;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment