Skip to content

Commit

Permalink
Add Support for Detecting Events Ending on or after 5 on a Friday
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo authored Mar 24, 2017
1 parent f3230ad commit 6a3fe4f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/freebusy.html
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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";

Expand Down

0 comments on commit 6a3fe4f

Please sign in to comment.