how to check time range in javascript

Use timestamp instead of Date object in order to efficiently compare ranges. This as well will be much more efficient for Database to index by timestamp.
If you don't know which of time is earlier in pair of dates for timespans, then you can do min and max checks. But if you do know which time is before and which after, no min, max in condition required.
Condition bellow checks if timespans Overlap which means it will be true even if only last second of first timespan overlaps with first second from second timespan.
You can do other checks for Contain and identify which of them contain which, but thats different condition.

// time of first timespan
var x = new Date('01/01/2001 8:30:00').getTime();
var y = new Date('01/01/2001 9:30:00').getTime();

// time of second timespan
var a = new Date('01/01/2001 8:54:00').getTime();
var b = new Date('01/01/2001 9:00:00').getTime();

if (Math.min(x, y) <= Math.max(a, b) && Math.max(x, y) >= Math.min(a, b)) {
    // between
}

i have another solution for that, we can use Moment-range which is plugin for Moment.js

Just check this Moment Range .

var start  = new Date(2012, 4, 1);
var end    = new Date(2012, 4, 23);
var lol    = new Date(2012, 4, 15);
var wat    = new Date(2012, 2, 27);
 var range  = moment().range(start, end);
 var range2 = moment().range(lol, wat);

 range.contains(lol); // true
 range.contains(wat); // false