{"version":3,"sources":["../src/diffYears.ts"],"sourcesContent":["import { diffMonths } from \"./diffMonths\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Returns the difference between 2 dates in years.\n * @param dateA - A date to compare with the dateB date\n * @param [dateB] - A date to compare with the dateA date or nothing to compare with the current time\n */\nexport function diffYears(dateA: DateInput, dateB?: MaybeDateInput): number\n\n/**\n * Returns the difference between 2 dates in years.\n * @param [dateA] - A date to compare with the dateB date or null to compare with the current time\n * @param dateB - A date to compare with the dateA date\n */\nexport function diffYears(dateA: MaybeDateInput, dateB: DateInput): number\nexport function diffYears(dateA: MaybeDateInput, dateB?: MaybeDateInput): number {\n  const r = Math.trunc(\n    //@ts-ignore\n    diffMonths(dateA, dateB) / 12\n  )\n  //ensures we don't give back -0\n  return r == 0 ? 0 : r\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAgBpB,SAAS,UAAU,OAAuB,OAAgC;AAC/E,QAAM,IAAI,KAAK;AAAA;AAAA,IAEb,WAAW,OAAO,KAAK,IAAI;AAAA,EAC7B;AAEA,SAAO,KAAK,IAAI,IAAI;AACtB;","names":[]}