Is the first date before the second one?
Is the first date before the second one?
// CommonJS
var isBefore = require('date-fns/isBefore')
// ES 2015 import isBefore from 'date-fns/isBefore'
// ESM
import { isBefore } from 'date-fns'
isBefore(date, dateToCompare)
| Name | Description |
|---|---|
date |
the date that should be before the other one to return true |
dateToCompare |
the date to compare with |
| Description |
|---|
|
the first date is before the second date |
| Type | Description |
|---|---|
TypeError |
2 arguments required |
// Is 10 July 1989 before 11 February 1987? const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11)) //=> false
© 2021 Sasha Koss and Lesha Koss
Licensed under the MIT License.
https://date-fns.org/v2.29.2/docs/isBefore