Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript check date is greater than today

// make use of date-fns

const date1 = endOfDay(dateToCompare) // passed date with time 00:00
const date2 = endOfDay(new Date()) // get current Date with time 00:00

if (isAfter(date1, date2)) {
	console.log(`The passed Date: ${date1} lies in the future`
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #check #date #greater #today
ADD COMMENT
Topic
Name
8+1 =