I have a start and end time along with a date.
stime:1pm , etime:2pm , date:2/6/2013
I want to save this time and start and end date in mongodb. therefore, before saving this information
I have to check within this date whether this time range exists or not
so how to do it in javascript. How to check the time range already exists or not?
I tried how this.but is not working properly. even I donβt know my approach, right or wrong?
I hope someone helps me find a solution to this.
var d0 = new Date("01/01/2001 " + "8:30 AM"); var d1 = new Date("01/01/2001 " + "9:00 PM"); var d2 = new Date("01/01/2001 " + "8:30 AM"); var d3 = new Date("01/01/2001 " + "9:00 PM"); if(d2<d0&&d3<=d0||d2<d1&&d3<=d3) { console.log("available"); }else{ console.log("not available"); }
source share