isInPast
Returns a boolean, true
if the given date is in the past.
Usage
import { isInPast } from 'easy-dates'
isInPast(date)
Prop types
Throws an error when given a type other than Date
.
prop | type | required | default |
---|---|---|---|
date | date | yes | n/a |
Examples
isInPast(new Date('2022-01-01')) // true
isInPast(new Date('2030-01-01')) // false
isInPast('2022-01-02') // throws an error