← Snippets

isDateBefore

1function isDateBefore(date1, date2) {
2 if (date1.getFullYear() < date2.getFullYear()) {
3 return true
4 }
5 if (date1.getMonth() < date2.getMonth()) {
6 return true
7 }
8 if (date1.getDate() < date2.getDate()) {
9 return true
10 }
11 return false
12}
13
Site Logo - Andrew Lazenka
© 2021 Andrew Lazenka. All Rights Reserved.