UNPKG

@technobuddha/library

Version:
21 lines (18 loc) 685 B
import { type DateOptions } from './date.ts'; import { isSameMonth } from './is-same-month.ts'; /** * Determine if two dates occur on the same day * @param input1 - The first date * @param input2 - The second date * @param options - see {@link DateOptions} * @defaultValue utc false * @returns true, if the two dates fall on the same day * @group Time * @category Day */ export function isSameDay(input1: Date, input2: Date, { utc = false }: DateOptions = {}): boolean { if (utc) { return input1.getUTCDate() === input2.getUTCDate() && isSameMonth(input1, input2, { utc }); } return input1.getDate() === input2.getDate() && isSameMonth(input1, input2, { utc }); }