diff --git a/frontend/slideshow.html b/frontend/slideshow.html index 8bad508..8e48a01 100755 --- a/frontend/slideshow.html +++ b/frontend/slideshow.html @@ -214,7 +214,7 @@ document.addEventListener("DOMContentLoaded", function() { photoIndex = -1; nextPhoto(); } else { - info.textContent = "No photos found for " + holiday + "."; + info.textContent = "No photos found for " + data.holiday + "."; } }).catch(function(error) { console.error(error); diff --git a/server/routes/photos.js b/server/routes/photos.js index 311a485..2d57508 100755 --- a/server/routes/photos.js +++ b/server/routes/photos.js @@ -551,7 +551,7 @@ router.get("/holiday/:holiday", function(req, res/*, next*/) { return res.status(404).send(req.params.holiday + " holiday not found."); } holidayName = Object.getOwnPropertyNames(lookup)[0]; - + console.log("Searching for holiday: " + holidayName); /* Lookup the date for the holiday on every year from 'startYear' (1990) to today */ for (let year = startYear; year <= moment().year(); year++) { console.log("Getting year: " + year); @@ -564,12 +564,22 @@ router.get("/holiday/:holiday", function(req, res/*, next*/) { /* * NOTE: Memorial Day and Labor Day are two special cases -- the holiday is a Monday, * however the entire weekend typically is holidy-esque. Account for that below. - * We (should) could expand this to account for Fri or Mon on the 4th of July, Christmas, - * or New Years as well. */ + * + * For those that have 'eve' celebrations, include those too. + * + * We (should) could expand this to account for Fri or Mon on the 4th of July or the + * entire weekend if it occurs on a Thu or Tues */ let extraDays = 0; - if (req.params.holiday.toLowerCase() == 'memorial day') { + switch (req.params.holiday.toLowerCase()) { + case 'labor day': + case 'memorial day': extraDays = -2; /* Include two days prior */ + break; + case 'christmas day': + case 'new year\'s day': + extraDays = -1; /* Include 'Eve' */ + break; } let direction = extraDays < 0 ? -1 : 1;