Are the given dates in the same year?
Are the given dates in the same year?
// CommonJS
var isSameYear = require('date-fns/isSameYear')
// ES 2015 import isSameYear from 'date-fns/isSameYear'
// ESM
import { isSameYear } from 'date-fns'
isSameYear(dateLeft, dateRight)
| Name | Description |
|---|---|
dateLeft |
the first date to check |
dateRight |
the second date to check |
| Description |
|---|
|
the dates are in the same year |
| Type | Description |
|---|---|
TypeError |
2 arguments required |
// Are 2 September 2014 and 25 September 2014 in the same year? const result = isSameYear(new Date(2014, 8, 2), new Date(2014, 8, 25)) //=> true
© 2021 Sasha Koss and Lesha Koss
Licensed under the MIT License.
https://date-fns.org/v2.29.2/docs/isSameYear