Answers for "js check if date is within range"

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

Code answers related to "js check if date is within range"

Browse Popular Code Answers by Language