date-manip
Version:
A lightweight JavaScript date utility library that provides modularity, high performance, and additional features. It supports various date operations, including date addition and subtraction, formatting, comparison, etc.
15 lines (14 loc) • 561 B
TypeScript
/**
* Subtracts a specified number of days from a date.
* 从日期中减去指定数量的天数。
*
* @param date - The date to subtract days from. (要减去天数的日期。)
* @param days - The number of days to subtract. (要减去的天数。)
* @returns A new date with the subtracted days. (减去天数后的新日期。)
* @example
* ```ts
* const newDate = subDays(new Date(), 5);
* console.log(newDate); // Outputs the date 5 days ago (输出5天前的日期)
* ```
*/
export default function subDays(date: Date, days: number): Date;