I'm trying to have an IF check to see if X date range is between Y date range. But it's not returning the correct true/false on the correct time:
var startdate = new Date('06/06/2013');
var enddate = new Date('06/25/2013');
var startD = new Date('06/08/2013');
var endD = new Date('06/18/2013');
if(startD >= startdate || endD <= enddate) {
return true;
} else {
return false;
}
This works, but if I change startdate to 06/09/2013 and enddate to 06/17/2013 it no longer works while it should work.
It should even work if startdate was 06/07/2013 and enddate was 06/15/2013, but doesn't. Any thoughts?
>=) but exclusive end dates (<). Otherwise, you may get overlaps that you didn't actually want. Read more here.