// Weeks function WeeklySpreadsheet(start, key) { this.start = new Date(start); this.key = key; this.setTitle = () => { let end = addDays(this.start, 6); let monthsArr = new Months().short; return monthsArr[this.start.getMonth()] + ' ' + this.start.getDate() + ' — ' + monthsArr[end.getMonth()] + ' ' + end.getDate(); }; this.createAnchor = purpose => { let title = this.setTitle(), text = ''; let active = new Date().getTime() >= this.start.getTime(); let anchor = '' + ((active) ? text + '' : '' + text); return anchor; }; } // Assistance function addDays(date, days) { return new Date(date.getTime() + days * 24 * 60 * 60 * 1000); }