Skip to main content

isAfter()

Returns a boolean, true if the first date is after the second date.

Usage

import { isAfter } from 'easy-dates'

isAfter(date, dateToCompare)

Prop types

proptyperequireddescription
datedateyesThe date to compare
dateToComparedateyesThe date to compare with

Examples

isAfter(new Date('2022-01-01'), new Date('2022-01-02')) // true
isAfter(new Date('2022-01-01'), new Date('2022-01-01')) // false
isAfter(new Date('2022-01-02'), new Date('2022-01-01')) // false
const today = new Date();
const tomorrow = new Date(today.getTime() + 24 * 60 * 60 * 1000);
isAfter(tomorrow.toString(), today) // error