Files
SnowLuma/.pnpm-store/v11/files/a1/5f46991fc26522aaa64e4b8e8089af08dc0da71213aec42b4f1bcd301236c7c40fe358245373f4448b5dd069cd401a4c04d5672494460b4c9496cff6466d03
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

17 lines
653 B
Plaintext

/**
* Subtracts a specified number of years from a date.
* 从日期中减去指定数量的年份。
*
* @param date - The date to subtract years from. (要减去年份的日期。)
* @param years - The number of years to subtract. (要减去的年份数。)
* @returns A new date with the subtracted years. (减去年份后的新日期。)
* @example
* ```ts
* //Subtracting 2 years from a date (从日期中减去2)
* const date = new Date('2023-10-01T12:00:00Z');
* subYears(date, 2);
* // Returns: 2021-10-01T12:00:00.000Z (返回: 2021-10-01T12:00:00.000Z)
* ```
*/
export default function subYears(date: Date, years: number): Date;