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

isSameHour

import { isSameHour } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// Are 4 September 2014 06:00:00 and 4 September 06:30:00 in the same hour?
const result = isSameHour(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 6, 30))
//=> true
@example
// Are 4 September 2014 06:00:00 and 5 September 06:00:00 in the same hour?
const result = isSameHour(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 5, 6, 0))
//=> false
function isSameHour<DateType extends Date>(dateLeft: DateType | number | string, dateRight: DateType | number | string): boolean;
§
isSameHour<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 hour (and same day)