UNPKG

datemapper

Version:

A lightweight date utility for format conversion, validation, and date manipulation.

15 lines (14 loc) 829 B
import { TIncrementType } from "./types"; /** * Decrements a given date by a specified time unit (day, month, hour, year, or week). * Ensures proper timezone adjustments while maintaining consistency in date calculations. * * @param date - The initial Date object that will be decremented. * @param incrementType - The unit of time by which the date should be decremented. * Accepts one of the following values: "day", "month", "hour", "year", "week". * @param timezone - The timezone in which the date should be interpreted and adjusted. * @returns A new Date object representing the decremented date. * @throws {Error} If an invalid increment type is provided. */ declare const decrementDate: (date: Date, incrementType: TIncrementType, timezone: string) => Date; export default decrementDate;