Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

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;
§
isSameSecond<DateType extends Date>(dateLeft: DateType | number | string, dateRight: DateType | number | string): boolean
[src]

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
dateLeft: DateType | number | string
[src]
  • The first date to check
§
dateRight: DateType | number | string
[src]
  • The second date to check

§Return Type

§
boolean
[src]

The dates are in the same second (and hour and day)