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