{"version":3,"file":"diffMonths.cjs","names":[],"sources":["../../src/date/diffMonths.ts"],"sourcesContent":["/**\n * Calculates the number of months between two dates.\n *\n * @param date1 - The first date\n * @param date2 - The second date\n * @returns The number of months between the two dates (positive if date1 > date2)\n *\n * @example\n * diffMonths(new Date('2024-04-15'), new Date('2024-01-15')) // => 3\n * diffMonths(new Date('2024-01-15'), new Date('2024-04-15')) // => -3\n */\nexport function diffMonths(date1: Date, date2: Date): number {\n  if (!(date1 instanceof Date) || isNaN(date1.getTime())) {\n    return NaN;\n  }\n\n  if (!(date2 instanceof Date) || isNaN(date2.getTime())) {\n    return NaN;\n  }\n\n  const year1 = date1.getFullYear();\n  const month1 = date1.getMonth();\n  const year2 = date2.getFullYear();\n  const month2 = date2.getMonth();\n\n  return (year1 - year2) * 12 + (month1 - month2);\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,WAAW,OAAa,OAAqB;CAC3D,IAAI,EAAE,iBAAiB,SAAS,MAAM,MAAM,QAAQ,CAAC,GACnD,OAAO;CAGT,IAAI,EAAE,iBAAiB,SAAS,MAAM,MAAM,QAAQ,CAAC,GACnD,OAAO;CAGT,MAAM,QAAQ,MAAM,YAAY;CAChC,MAAM,SAAS,MAAM,SAAS;CAC9B,MAAM,QAAQ,MAAM,YAAY;CAChC,MAAM,SAAS,MAAM,SAAS;CAE9B,QAAQ,QAAQ,SAAS,MAAM,SAAS;AAC1C"}