From 0ed8bca1a4ff10c21c687546c8c1c35d5c8d32f4 Mon Sep 17 00:00:00 2001
From: Jason Bazalar <jbazalar@kcet.org>
Date: Fri, 10 May 2019 17:27:47 -0700
Subject: [PATCH 1/3] JS: Combine two for loops for identifying which week to
 append days to

---
 custom.js | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/custom.js b/custom.js
index 5b46448..8ef57df 100644
--- a/custom.js
+++ b/custom.js
@@ -155,14 +155,12 @@
 
 		let meetupsByDay = getWeekFormattedMeetups(meetups);
 
-		for(let i=0; i <= 6; i++) {
-			let week1div = '<div class="day" id="' + days[i].dow.toLowerCase() + days[i].date + '"></div>';
-			document.querySelector('#firstweek').insertAdjacentHTML('beforeend', week1div);
-		}
-
-		for(let i=7; i <= 13; i++) {
-			let week2div = '<div class="day" id="' + days[i].dow.toLowerCase() + days[i].date + '"></div>';
-			document.querySelector('#secondweek').insertAdjacentHTML('beforeend', week2div);
+		// 14 days, 0-indexed
+		for(let i=0; i < 14; i++) {
+			// Determine which week we're on
+			let weekid = ( i<7 ) ? 'first' : 'second';
+			let weekdiv = '<div class="day" id="' + days[i].dow.toLowerCase() + days[i].date + '"></div>';
+			document.querySelector('#' + weekid + 'week').insertAdjacentHTML('beforeend', weekdiv);
 		}
 
 		for(let i=0; i < days.length; i++) {

From 836a190ef53e2cd64eeefa454315aae18f99e171 Mon Sep 17 00:00:00 2001
From: Jason Bazalar <jbazalar@kcet.org>
Date: Fri, 10 May 2019 17:45:52 -0700
Subject: [PATCH 2/3] JS: Added getMonths() getDays(), Week View now bolds
 current day

---
 custom.js | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/custom.js b/custom.js
index 8ef57df..8242d2c 100644
--- a/custom.js
+++ b/custom.js
@@ -150,6 +150,8 @@
 	// Display Meetup Data in Week View
 	function listMeetupsinWeekView(data) {
 
+		let today = new Date();
+		let weekdays = getDays();
 		let days = data.days;
 		let meetups = data.results;
 
@@ -167,17 +169,20 @@
 			let weekday = days[i];
 			let dowDay = weekday.dow.substring(0,3) + weekday.date;
 			let meetupString = meetupsByDay[dowDay];
-			let formattedWeek = '<div class="weekday">'
+			let isToday = ( (weekdays[today.getDay()].substring(0, 3) + today.getDate()) == dowDay )? " today" : "";
+			let formattedWeek = '<div class="weekday'+ isToday + '">'
 				+ weekday.dow.substring(0,3) + ' ' 
 				+ weekday.month.substring(0,3) + ' ' 
 				+ weekday.date
 				+ '</div>';
+			// If meetups exist
 			if(meetupString) {
 				formattedWeek += meetupString.join('');	
-
+			// Otherwise indicate no meetups for the day
 			} else {
 				formattedWeek += '<div class="week-meetup-none">No meetups!</div';
-			}			
+			}
+			// Append to weekday
 			$('#' + weekday.dow.toLowerCase() + weekday.date).append(formattedWeek);
 		}
 	}
@@ -241,8 +246,8 @@
 
 	// Get Week Range
 	function getCurrentDates(numOfWeeks) {
-		const weekdays = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
-		const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
+		const months = getMonths();
+		const weekdays = getDays();
 		let numOfDays = numOfWeeks * 7;
 		let days = [];
 		let today = new Date;
@@ -262,8 +267,8 @@
 
 	}
 	function getDateFormats(meetup) {
-		const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
-		const weekdays = ['Sunday','Monday','Tueday','Wednesday','Thursday','Friday','Saturday'];
+		const months = getMonths();
+		const weekdays = getDays();
 		const dt = new Date(meetup.time);
 
 		// Setup event date info
@@ -283,6 +288,14 @@
 		return d;
 	}
 
+	function getMonths() {
+		return ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
+	}
+
+	function getDays() {
+		return ['Sunday','Monday','Tueday','Wednesday','Thursday','Friday','Saturday'];
+	}
+
 	function formatAMPM(date) {
 		let hours = date.getHours();
 		let minutes = date.getMinutes();

From d566aa2c679e6a3cb188630721d5fba5084ea005 Mon Sep 17 00:00:00 2001
From: Jason Bazalar <jbazalar@kcet.org>
Date: Fri, 10 May 2019 17:46:22 -0700
Subject: [PATCH 3/3] CSS: Add styles for week.today to bold current day in
 week view

---
 style.css | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/style.css b/style.css
index 582af4c..c93c176 100644
--- a/style.css
+++ b/style.css
@@ -140,6 +140,9 @@ section {
   text-overflow: ellipsis;
   overflow: hidden;
 }
+.weekday.today {
+  font-weight: bold;
+}
 .week-meetup, .week-meetup-none {
   border: 1px solid #b74949;
   border-radius: 5px; 
