isDateBefore
Compares two vanilla Javascript Date objects. Returns true is the first date falls before the second.
1function isDateBefore(date1, date2) {2 if (date1.getFullYear() < date2.getFullYear()) {3 return true4 }5 if (date1.getMonth() < date2.getMonth()) {6 return true7 }8 if (date1.getDate() < date2.getDate()) {9 return true10 }11 return false12}13