You can use the isPast
function from date-fns
to check if a given date is in the past or not. Here's how:
Install the package using npm by running npm install date-fns
.
Import isPast
function in your code:
index.tsx35 chars2 lines
isPast
function as below:index.tsx100 chars4 lines
The isPast
function returns true
if the given date is in the past and false
otherwise.
gistlibby LogSnag