{"version":3,"file":"addYears.mjs","names":[],"sources":["../../src/date/addYears.ts"],"sourcesContent":["/**\n * Adds the specified number of years to the given date.\n *\n * @param date - The date to modify\n * @param amount - The number of years to add (can be negative)\n * @returns A new Date object with the years added\n *\n * @example\n * addYears(new Date('2024-01-15'), 1) // => Date object for 2025-01-15\n * addYears(new Date('2024-01-15'), -2) // => Date object for 2022-01-15\n */\nexport function addYears(date: Date, amount: number): Date {\n  if (!(date instanceof Date) || isNaN(date.getTime())) {\n    return new Date(NaN);\n  }\n\n  if (typeof amount !== 'number' || !isFinite(amount)) {\n    return new Date(NaN);\n  }\n\n  const result = new Date(date);\n  result.setFullYear(result.getFullYear() + Math.floor(amount));\n  return result;\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,SAAS,MAAY,QAAsB;CACzD,IAAI,EAAE,gBAAgB,SAAS,MAAM,KAAK,QAAQ,CAAC,GACjD,uBAAO,IAAI,KAAK,GAAG;CAGrB,IAAI,OAAO,WAAW,YAAY,CAAC,SAAS,MAAM,GAChD,uBAAO,IAAI,KAAK,GAAG;CAGrB,MAAM,SAAS,IAAI,KAAK,IAAI;CAC5B,OAAO,YAAY,OAAO,YAAY,IAAI,KAAK,MAAM,MAAM,CAAC;CAC5D,OAAO;AACT"}