hd-utils
Version:
A handy utils for modern JS developers
15 lines (12 loc) • 668 B
TypeScript
import { DateComparisonLevel } from "../types";
/**
* @description will check if the passed dates are equal, you can pass a comparisonLevel to determine the level of granularity for the date comparison
*
* @example
* const firstDate = new Date("2023-12-12T12:30:00");
const secondDate = new Date("2023-12-12T15:45:00");
compareDates(firstDate, secondDate); // Output: false
compareDates(firstDate, secondDate, "year"); // Output: true
compareDates(firstDate, secondDate, "hour"); // Output: false
*/
export default function compareDates(firstDate: string | Date, secondDate: string | Date, comparisonLevel?: DateComparisonLevel): boolean;