@sebgroup/frontend-tools
Version:
A set of frontend tools
11 lines (10 loc) • 665 B
TypeScript
/** The current supported ranges of modifying a date */
export declare type ModifyDateRange = "month" | "day" | "year" | "hours" | "seconds";
/**
* Modifies a date by either adding or substracting a certain range
* @param {Date} from {date} the starting date
* @param {number} value {number} the value (amount) you want added or substracted
* @param {"ADD" | "SUBTRACT"} type {ADD | SUBSTRACT} the operation type
* @param {"month" | "day" | "year" | "hours" | "seconds"} range the name of the range to modify, example: "month"
*/
export declare function modifyDate(from: Date, value: number, type: "ADD" | "SUBTRACT", range: ModifyDateRange): Date;