isSameSecond
import { isSameSecond } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// Are 4 September 2014 06:30:15.000 and 4 September 2014 06:30.15.500 in the same second?
const result = isSameSecond(
new Date(2014, 8, 4, 6, 30, 15),
new Date(2014, 8, 4, 6, 30, 15, 500)
)
//=> true
@example
// Are 4 September 2014 06:00:15.000 and 4 September 2014 06:01.15.000 in the same second?
const result = isSameSecond(
new Date(2014, 8, 4, 6, 0, 15),
new Date(2014, 8, 4, 6, 1, 15)
)
//=> false
@example
// Are 4 September 2014 06:00:15.000 and 5 September 2014 06:00.15.000 in the same second?
const result = isSameSecond(
new Date(2014, 8, 4, 6, 0, 15),
new Date(2014, 8, 5, 6, 0, 15)
)
//=> false
function isSameSecond<DateType extends Date>(dateLeft: DateType | number | string, dateRight: DateType | number | string): boolean;