- Determine if two timespans overlap using JavaScript Date objects.
- Calendar Event Double Booking
- Meeting Scheduling
- Witness Testimony Forensics
- Library Books
- Efficient Product Shipping
- Travel Happenstance Matcher
- Gantt Chart Critical Path
A timespan is an interval of time represented by 2 dates in time.
Usually start
and end
.
The difference between the 2 dates is the total duration of the timespan.
Write a function, isOverlapped
that takes in 2 timespans and determines if they overlap.
function isOverlapped (timespanA, timespanB) {
//return true if overlapping, false otherwise
}
For this exercise, represent timespans as objects:
var christmasTimespan = {
start: new Date("December 25, 2015"),
end: new Date("December 26, 2015")
};
Use moment.js instead of JavaScript Dates and repeat
the isOverlapped
exercise.
A timespan should be an object with Moments:
var christmasTimespan = {
start: moment("2015-12-25"),
end: moment("2015-12-26")
};
Useful documentation:
Given 2 arrays of timespan objects, return any conflicting timespans between the 2 arrays.
function scheduleOverlap(scheduleA, scheduleB) {
// return an array of any overlapping timespans.
}