function to detect date is past or future code example
Example: js check if date is future
var now = new Date();
if (before < now) {
// selected date is in the past
}
var now = new Date();
if (before < now) {
// selected date is in the past
}