From 6a3fe4f9924f27a3205ecd443e17061e3662c1e9 Mon Sep 17 00:00:00 2001 From: Leo Date: Fri, 24 Mar 2017 12:32:25 -0400 Subject: [PATCH] Add Support for Detecting Events Ending on or after 5 on a Friday --- src/freebusy.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/freebusy.html b/src/freebusy.html index 70eed3c..8f763e6 100644 --- a/src/freebusy.html +++ b/src/freebusy.html @@ -92,14 +92,18 @@ if (isMarkedAsAllDayEvent && (eventEnd.diff(eventStart, 'days') <= 6)) { // event is all-day and less than a week away // all-day events that end on a weekend... adjust to say they're returning the following monday - if (eventEnd.format("dddd") == "Saturday") { + if (eventEnd.format("ddd") == "Sat") { eventEnd.add(2, "days"); - } else if (eventEnd.format("dddd") == "Sunday") { + } else if (eventEnd.format("ddd") == "Sun") { eventEnd.add(1, "days"); } eventDuration = "Back on " + eventEnd.format("dddd"); + } else if (eventEnd.format("ddd") == "Fri" && eventEnd.hour() >= 17) { // event ends sometime at or after 5 on a Friday + + eventDuration = "Back on Monday"; + } else if (isMarkedAsAllDayEvent && (eventEnd.diff(eventStart, 'days') > 6)) { if (eventEnd.format("ddd") == "Fri") { @@ -122,7 +126,7 @@ eventDuration = "Back on " + eventEnd.format("ddd, MMMM Do (h:mm a)"); - } else if ((eventStart.hour() <= 8) && (eventEnd.hour() >= 17)) { // event is sometime before 9 until sometime after 5 + } else if (eventStart.hour() <= 8 && eventEnd.hour() >= 17) { // event is sometime before 9 until sometime after 5 eventDuration = "All day";