Answers for "if range of date inside of range of date javascript"

1

check if date is between range javascript

var a = new Date(2014, 0, 1);
var b = new Date(2014, 0, 2);
var inRange = dt >= a && dt <= b;
Posted by: Guest on June-07-2021
1

check if date is between range javascript

var a = new Date(2014, 0, 1);
var b = new Date(2014, 0, 2);

var c = new Date(b.getTime());   // clone the date to not muck the original value
c.setDate(c.getDate()+1);        // add a day
var inRange = dt >= a && dt < c; // use a half-open interval
Posted by: Guest on June-07-2021

Browse Popular Code Answers by Language