{"version":3,"sources":["../src/iso8601.ts","../src/date.ts","../src/addDay.ts","../src/monthEnd.ts","../src/monthDays.ts","../src/addMonth.ts","../src/addYear.ts","../src/addHour.ts","../src/addMinute.ts","../src/addSecond.ts","../src/addMillisecond.ts","../src/common.ts","../src/ap.ts","../src/applyOffset.ts","../src/deviceTZ.ts","../src/offset.ts","../src/tzDate.ts","../src/dayOfYear.ts","../src/dayEnd.ts","../src/dayStart.ts","../src/parts.ts","../src/removeOffset.ts","../src/deviceLocale.ts","../src/format.ts","../src/formatStr.ts","../src/fourDigitYear.ts","../src/hourEnd.ts","../src/hourStart.ts","../src/minuteEnd.ts","../src/minuteStart.ts","../src/monthStart.ts","../src/yearDays.ts","../src/nearestDay.ts","../src/range.ts","../src/parse.ts","../src/sameDay.ts","../src/sameSecond.ts","../src/sameMillisecond.ts","../src/sameMinute.ts","../src/sameHour.ts","../src/sameYear.ts","../src/weekStart.ts","../src/weekEnd.ts","../src/yearStart.ts","../src/yearEnd.ts","../src/isBefore.ts","../src/isAfter.ts","../src/isEqual.ts","../src/isPast.ts","../src/isFuture.ts","../src/diffMilliseconds.ts","../src/diffRound.ts","../src/diffSeconds.ts","../src/diffMinutes.ts","../src/diffHours.ts","../src/diffDays.ts","../src/diffWeeks.ts","../src/diffMonths.ts","../src/diffYears.ts"],"sourcesContent":["/**\n * Matches a given date with ISO 8601 compliance. Allows the \"T\" to be missing\n * and only requires year and month, other params are required with increasing\n * specificity. Supports timezone offsets with optional seconds (e.g., +05:32:11).\n */\nexport const iso8601Match =\n  /^([0-9]{4})-([0-1][0-9])(?:-([0-3][0-9]))?(?:[T ]?([0-2][0-9])(?::([0-5][0-9]))?(?::([0-5][0-9]))?)?(?:\\.[0-9]+)?(Z|(?:\\+|\\-)[0-9]{2}:?[0-9]{2}(?::?[0-9]{2})?)?$/\n\n/**\n * True when the date string is valid ISO 8601.\n * @param date - A date string.\n */\nexport function iso8601(date: string): boolean {\n  const matches = date.match(iso8601Match)\n  if (matches) {\n    const month = Number(matches[2])\n    if (month < 1 || month > 12) return false\n\n    if (typeof matches[3] !== undefined) {\n      const date = Number(matches[3])\n      if (date < 1 || date > 31) return false\n    }\n    if (typeof matches[4] !== undefined) {\n      const hours = Number(matches[4])\n      if (hours < 0 || hours > 23) return false\n    }\n\n    return true\n  }\n  return false\n}\n","import { iso8601, iso8601Match } from \"./iso8601\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Normalizes a \"short\" date like 2012-01-01 to 2012-01-01T00:00:00 to prevent\n * automatic coercion to UTC.\n * @param date - A string representation of the date.\n */\nfunction normalize(date: string) {\n  const matches = date.match(iso8601Match)\n  if (matches && typeof matches[4] === \"undefined\") {\n    return (date += \"T00:00:00\")\n  }\n  return date\n}\n\n/**\n * A date to parse.\n * @param date - A Date object or an ISO 8601 date.\n */\nexport function date(date?: MaybeDateInput): Date {\n  if (!date) {\n    date = new Date()\n  }\n  if (date instanceof Date) {\n    return new Date(date)\n  }\n  date = date.trim()\n  if (iso8601(date)) {\n    return new Date(normalize(date))\n  }\n  throw new Error(`Non ISO 8601 compliant date (${date}).`)\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a new date object 1/n days after the original one.\n * @param [inputDate] - A date to increment or null to increment from the current time.\n * @param [count] - The quantity to add.\n */\nexport function addDay(inputDate?: MaybeDateInput, count = 1) {\n  const d = date(inputDate)\n  d.setDate(d.getDate() + count)\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for the with the input date set to the last day of\n * the current month. Does not change the time.\n * @param [inputDate] - A string, Date object or nothing for the current month\n */\nexport function monthEnd(inputDate?: MaybeDateInput): Date {\n  const d = date(inputDate)\n  d.setDate(1)\n  d.setMonth(d.getMonth() + 1)\n  d.setDate(0)\n  return d\n}\n","import { monthEnd } from \"./monthEnd\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns the total number of days from a given month.\n * @param [inputDate] - A string, Date object or nothing for the current month\n */\nexport function monthDays(inputDate?: MaybeDateInput): number {\n  const d = monthEnd(inputDate)\n  return d.getDate()\n}\n","import { date } from \"./date\"\nimport { monthDays } from \"./monthDays\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Returns a new date object 1/n months after the original one. Keep in mind if you\n * start with a date late in a given month you could get a date after the next\n * month.\n * @param [inputDate] - A date to increment or null to increment from the current time\n * @param [count] - The quantity to add.\n * @param [dateOverflow] - Whether or not to allow the date to overflow to another month if the inputDate’s month is out of range of the new month.\n */\nexport function addMonth(inputDate?: MaybeDateInput, count = 1, dateOverflow = false) {\n  const d = date(inputDate)\n  const dayOfMonth = d.getDate()\n  // If overflowing is disallowed, set the date back to the first of the month\n  if (!dateOverflow) d.setDate(1)\n  d.setMonth(d.getMonth() + count)\n\n  // If overflowing is disallowed, we need to set the date back to the proper\n  // day or the last day of the month.\n  if (!dateOverflow) {\n    const daysInMonth = monthDays(d)\n    d.setDate(daysInMonth < dayOfMonth ? daysInMonth : dayOfMonth)\n  }\n  return d\n}\n","import { date } from \"./date\"\nimport { monthDays } from \"./monthDays\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a new date object 1/n years after the original one. Keep in mind if\n * you start with a date late in a given month you could get a date after the\n * next month.\n * @param [inputDate] - A date to increment or null to increment from the current time.\n * @param [count] - The quantity of years add.\n * @param [dateOverflow] - Whether or not to allow the date to overflow to another month if the inputDate’s month is out of range of the new month.\n */\nexport function addYear(inputDate?: MaybeDateInput, count = 1, dateOverflow = false) {\n  const d = date(inputDate)\n  const dayOfMonth = d.getDate()\n  // If overflowing is disallowed, set the date back to the first of the month\n  if (!dateOverflow) d.setDate(1)\n\n  d.setFullYear(d.getFullYear() + count)\n\n  // If overflowing is disallowed, we need to set the date back to the proper\n  // day or the last day of the month.\n  if (!dateOverflow) {\n    const daysInMonth = monthDays(d)\n    d.setDate(daysInMonth < dayOfMonth ? daysInMonth : dayOfMonth)\n  }\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a new date object 1/n hours after the original one.\n * @param [inputDate] - A date to increment or null to increment from the current time.\n * @param [count] - The quantity to add.\n */\nexport function addHour(inputDate?: MaybeDateInput, count = 1) {\n  const d = date(inputDate)\n  d.setHours(d.getHours() + count)\n  return d\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Returns a new date object 1/n minutes after the original one.\n * @param [inputDate] - A date to increment or null to increment from the current time.\n * @param [count] - The quantity to add.\n */\nexport function addMinute(inputDate?: MaybeDateInput, count = 1) {\n  const d = date(inputDate)\n  d.setMinutes(d.getMinutes() + count)\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a new date object 1/n seconds after the original one.\n * @param [inputDate] - A date to increment or null to increment from the current time.\n * @param [count] - The quantity to add.\n */\nexport function addSecond(inputDate?: MaybeDateInput, count = 1) {\n  const d = date(inputDate)\n  d.setSeconds(d.getSeconds() + count)\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a new date object 1/n milliseconds after the original one.\n * @param [inputDate] - A date to increment or null to increment from the current time.\n * @param [count] - The quantity to add.\n */\nexport function addMillisecond(inputDate?: MaybeDateInput, count = 1) {\n  const d = date(inputDate)\n  d.setMilliseconds(d.getMilliseconds() + count)\n  return d\n}\n","import { date } from \"./date\"\nimport { ap } from \"./ap\"\nimport type {\n  DateInput,\n  NamedFormats,\n  FormatPattern,\n  FormatStyle,\n  Part,\n  FilledPart,\n  Format,\n  MaybeDateInput,\n  ExtendedPartTypes,\n} from \"./types\"\n\n/**\n * A date to use for determining various spec details.\n */\nexport const specDate = \"1999-03-04T02:05:01.000Z\"\n\n/**\n * A cache of Intl tokens and their respective formats.\n */\nexport const memoParts: Map<string, NamedFormats> = new Map()\n\n/**\n * Clock agnostic time format patterns.\n */\nexport const clockAgnostic: FormatPattern[] = [\n  [\"YYYY\", { year: \"numeric\" }],\n  [\"YY\", { year: \"2-digit\" }],\n  [\"MMMM\", { month: \"long\" }],\n  [\"MMM\", { month: \"short\" }],\n  [\"MM\", { month: \"2-digit\" }],\n  [\"M\", { month: \"numeric\" }],\n  [\"DD\", { day: \"2-digit\" }],\n  [\"D\", { day: \"numeric\" }],\n  [\"dddd\", { weekday: \"long\" }],\n  [\"ddd\", { weekday: \"short\" }],\n  [\"d\", { weekday: \"narrow\" }],\n  [\"mm\", { minute: \"2-digit\" }],\n  [\"m\", { minute: \"numeric\" }],\n  [\"ss\", { second: \"2-digit\" }],\n  [\"s\", { second: \"numeric\" }],\n  [\"ZZ\", { timeZoneName: \"long\" }],\n  [\"Z\", { timeZoneName: \"short\" }],\n]\n\n/**\n * Timezone tokens.\n */\nconst timeZoneTokens = [\"Z\", \"ZZ\"] as const\n\n/**\n * Timezone token type.\n */\nexport type TimezoneToken = (typeof timeZoneTokens)[number]\n\n/**\n * 24 hour click format patterns.\n */\nexport const clock24: FormatPattern[] = [\n  [\"HH\", { hour: \"2-digit\" }],\n  [\"H\", { hour: \"numeric\" }],\n]\n\n/**\n * 12 hour format patterns.\n */\nexport const clock12: FormatPattern[] = [\n  [\"hh\", { hour: \"2-digit\" }],\n  [\"h\", { hour: \"numeric\" }],\n  [\"a\", { dayPeriod: \"narrow\" }],\n  [\"A\", { dayPeriod: \"narrow\" }],\n]\n\n/**\n * Fractional seconds patterns.\n */\nexport const fractionalSeconds: FormatPattern[] = [\n  [\"SSS\", { fractionalSecond: \"3-digit\" }],\n]\n\n/**\n * Tokens that have a fixed length.\n */\nexport const fixedLength = {\n  DD: 2,\n  HH: 2,\n  MM: 2,\n  YY: 2,\n  YYYY: 4,\n  hh: 2,\n  mm: 2,\n  ss: 2,\n}\n\n/**\n * Determines the length of a timezone offset string.\n * Supports offsets with optional seconds component.\n */\nexport function fixedLengthByOffset(offsetString: string): 9 | 8 | 6 | 5 {\n  // starts with [+-]xx:xx:xx (9 chars, Z format with seconds)\n  if (/^[+-]\\d{2}:\\d{2}:\\d{2}/.test(offsetString)) {\n    return 9\n  }\n\n  // starts with [+-]xxxxxx (8 chars, ZZ format with seconds)\n  if (/^[+-]\\d{6}/.test(offsetString)) {\n    return 8\n  }\n\n  // starts with [+-]xx:xx (6 chars, Z format)\n  if (/^[+-]\\d{2}:\\d{2}/.test(offsetString)) {\n    return 6\n  }\n\n  // starts with [+-]xxxx (5 chars, ZZ format)\n  if (/^[+-]\\d{4}/.test(offsetString)) {\n    return 5\n  }\n\n  throw new Error(\"Invalid offset format\")\n}\n\n/**\n * Tokens that are genitive — in that they can have \"possession\" when used in\n * a date phrase, \"March’s 4th day\" (but not in english).\n *\n * When computing a range for these, the range can be either genitive or not.\n * The same is true for parsing dates containing these tokens.\n */\nexport const genitiveTokens = [\"MMMM\", \"MMM\", \"dddd\", \"ddd\"]\n\n/**\n * A map of FormatPattern tuples to their respective token.\n */\nexport const tokens = /* @__PURE__ */ new Map(\n  /* @__PURE__ */ [...clockAgnostic, ...clock24, ...clock12, ...fractionalSeconds].map((format) => {\n    return [format[0], format]\n  })\n)\n\n/**\n * A map of locale’s am/pm.\n */\nexport const dayPeriodMap: Map<string, { am?: string; pm?: string }> = new Map()\n\n/**\n * An array of all available date styles.\n */\nexport const styles: ReadonlyArray<FormatStyle> = [\"full\", \"long\", \"medium\", \"short\"]\n\n/**\n * Creates a leading zero string of 2 digits.\n * @param n - A number.\n */\nexport const two = (n: number) => String(n).padStart(2, \"0\")\n/**\n * Creates a leading zero string of 4 digits.\n * @param n - A number.\n */\nexport const four = (n: number) => String(n).padStart(2, \"0\")\n\n/**\n * Normalizes a given part to NFKC.\n * @param part - The part to normalize.\n */\nexport function normStr(part: Intl.DateTimeFormatPart): Intl.DateTimeFormatPart {\n  if (part.type === \"literal\") {\n    part.value = part.value.normalize(\"NFKC\")\n  }\n  return part\n}\n\n/**\n * Returns the parts filled with pertinent values.\n * @param [inputDate] - The date to fill parts for\n * @param parts - An array of parts to fill\n * @param locale - The locale to fill with.\n * @param genitive - Whether to use genitive tokens values or not.\n * @param offset - The explicit offset to fill with (ignores the date’s true offset).\n */\nexport function fill(\n  inputDate: MaybeDateInput,\n  parts: Part[],\n  locale: string,\n  genitive = false,\n  offset: string | null = null\n): FilledPart[] {\n  const partMap = createPartMap(inputDate, parts, locale, genitive)\n  const d = date(inputDate)\n\n  /**\n   * Not all values get returned \"properly\" as our tokens would suggest. For\n   * example, at times Intl returns leading zeros when it shouldn't. This fn\n   * is used to clean up those irregular values.\n   * @param param - Part\n   */\n  function value({ partName, partValue, token }: Part) {\n    if (partName === \"literal\") return partValue\n    const value = partMap[partName]\n    if (partName === \"hour\" && token === \"H\") {\n      return value.replace(/^0/, \"\") || \"0\"\n    }\n    if ([\"mm\", \"ss\", \"MM\"].includes(token) && value.length === 1) {\n      // Some tokens are supposed to have leading zeros, but Intl doesn't\n      // always return them, depending on the locale and the format.\n      return `0${value}`\n    }\n    if (partName === \"dayPeriod\") {\n      const p = ap(d.getUTCHours() < 12 ? \"am\" : \"pm\", locale)\n      return token === \"A\" ? p.toUpperCase() : p.toLowerCase()\n    }\n    if (partName === \"fractionalSecond\") {\n      return String(d.getUTCMilliseconds()).padStart(3, \"0\")\n    }\n    if (partName === \"timeZoneName\") {\n      return offset ?? minsToOffset(-1 * d.getTimezoneOffset(), token)\n    }\n    return value\n  }\n\n  return parts.map((part): FilledPart => {\n    return {\n      ...part,\n      value: value(part),\n    }\n  })\n}\n\n/**\n * Creates a map of part names to their respective values.\n * @param [inputDate] - The date to format\n * @param parts - The individual parts the need to be formatted.\n * @param locale - The locale to format the parts with.\n * @param genitive - Whether to use genitive tokens values or not.\n */\nfunction createPartMap(\n  inputDate: MaybeDateInput,\n  parts: Part[],\n  locale: string,\n  genitive = false\n): Record<ExtendedPartTypes, string> {\n  const d = date(inputDate)\n  const hour12 = parts.filter((part) => part.hour12)\n  const hour24 = parts.filter((part) => !part.hour12)\n  const valueParts: Intl.DateTimeFormatPart[] = []\n  const genitiveParts: Part[] = []\n\n  function addValues(requestedParts: Part[], hour12 = false) {\n    const preciseLocale = `${locale}-u-hc-${hour12 ? \"h12\" : \"h23\"}`\n    valueParts.push(\n      ...new Intl.DateTimeFormat(\n        preciseLocale,\n        requestedParts.reduce(\n          (options, part) => {\n            if (part.partName === \"literal\") return options\n            // Side effect! Genitive parts get shoved into a separate array.\n            if (genitive && genitiveTokens.includes(part.token)) {\n              genitiveParts.push(part)\n            }\n            return Object.assign(options, part.option)\n          },\n          { timeZone: \"UTC\" } as Intl.DateTimeFormatOptions\n        )\n      )\n        .formatToParts(d)\n        .map(normStr)\n    )\n    if (genitive && genitiveParts.length) {\n      for (const part of genitiveParts) {\n        let formattedParts: Intl.DateTimeFormatPart[] = []\n        switch (part.token) {\n          case \"MMMM\":\n            formattedParts = new Intl.DateTimeFormat(preciseLocale, {\n              dateStyle: \"long\",\n              timeZone: \"UTC\",\n            })\n              .formatToParts(d)\n              .map(normStr)\n            break\n          case \"MMM\":\n            formattedParts = new Intl.DateTimeFormat(preciseLocale, {\n              dateStyle: \"medium\",\n              timeZone: \"UTC\",\n            })\n              .formatToParts(d)\n              .map(normStr)\n            break\n        }\n        const genitiveFormattedPart = formattedParts.find((p) => p.type === part.partName)\n        const index = valueParts.findIndex((p) => p.type === part.partName)\n        if (genitiveFormattedPart && index > -1) {\n          valueParts[index] = genitiveFormattedPart\n        }\n      }\n    }\n  }\n\n  if (hour12.length) addValues(hour12, true)\n  if (hour24.length) addValues(hour24)\n\n  return valueParts.reduce((map, part) => {\n    map[part.type as ExtendedPartTypes] = part.value\n    return map\n  }, {} as Record<ExtendedPartTypes, string>)\n}\n\n/**\n * Converts total seconds to an ISO8601 compatible offset (+04:00 or +0400).\n * Only includes seconds in output if they are non-zero.\n * @param totalSecs - The total offset in seconds (can be negative).\n * @param token - \"Z\" for +HH:mm[:ss] or \"ZZ\" for +HHmm[ss]\n */\nexport function secsToOffset(totalSecs: number, token: string = \"Z\"): string {\n  const sign = totalSecs < 0 ? \"-\" : \"+\"\n  const absSecs = Math.abs(totalSecs)\n  const hours = String(Math.floor(absSecs / 3600)).padStart(2, \"0\")\n  const mins = String(Math.floor((absSecs % 3600) / 60)).padStart(2, \"0\")\n  const secs = Math.round(absSecs % 60)\n\n  if (token === \"ZZ\") {\n    return secs === 0\n      ? `${sign}${hours}${mins}`\n      : `${sign}${hours}${mins}${String(secs).padStart(2, \"0\")}`\n  }\n  return secs === 0\n    ? `${sign}${hours}:${mins}`\n    : `${sign}${hours}:${mins}:${String(secs).padStart(2, \"0\")}`\n}\n\n/**\n * Converts minutes (300) to an ISO8601 compatible offset (+0400 or +04:00).\n * @param timeDiffInMins - The difference in minutes between two timezones.\n * @returns\n */\nexport function minsToOffset(timeDiffInMins: number, token: string = \"Z\"): string {\n  return secsToOffset(timeDiffInMins * 60, token)\n}\n\n/**\n * Converts an offset (-05:32:11 or -053211) to total seconds.\n * Supports offsets with optional seconds component.\n * @param offset - The offset to convert to seconds.\n * @param token - The timezone token format.\n */\nexport function offsetToSecs(offset: string, token: TimezoneToken): number {\n  validOffset(offset, token)\n  const match = offset.match(/([+-])([0-3][0-9]):?([0-5][0-9])(?::?([0-5][0-9]))?/)!\n  const [_, sign, hours, mins, secs = \"0\"] = match\n  const totalSecs = Number(hours) * 3600 + Number(mins) * 60 + Number(secs)\n  return sign === \"+\" ? totalSecs : -totalSecs\n}\n\n/**\n * Converts an offset (-0500) to minutes (-300).\n * @param offset - The offset to convert to minutes.\n * @param token - The timezone token format.\n */\nexport function offsetToMins(offset: string, token: TimezoneToken): number {\n  return Math.round(offsetToSecs(offset, token) / 60)\n}\n\n/**\n * Validates that an offset is valid according to the format:\n * [+-]HH:mm or [+-]HH:mm:ss (Z token)\n * [+-]HHmm or [+-]HHmmss (ZZ token)\n * @param offset - The offset to validate.\n * @param token - The timezone token format.\n */\nexport function validOffset(offset: string, token: TimezoneToken = \"Z\") {\n  const valid = ((token: TimezoneToken): boolean => {\n    switch (token) {\n      case \"Z\":\n        return /^([+-])[0-3][0-9]:[0-5][0-9](?::[0-5][0-9])?$/.test(offset)\n      case \"ZZ\":\n        return /^([+-])[0-3][0-9][0-5][0-9](?:[0-5][0-9])?$/.test(offset)\n    }\n  })(token)\n\n  if (!valid) throw new Error(`Invalid offset: ${offset}`)\n  return offset\n}\n\n/**\n * Given a string of tokens, escape any characters that are tokens.\n * @param str - The string to escape tokens in.\n * @returns The escaped string.\n */\nexport function escapeTokens(str: string): string {\n  return clockAgnostic\n    .concat(clock24)\n    .concat(clock12)\n    .concat(fractionalSeconds)\n    .sort((a, b) => (a[0].length > b[0].length ? 1 : -1))\n    .reduce((target, part) => {\n      return target.replace(part[0], `\\\\${part[0]}`)\n    }, str)\n}\n\n/**\n * Checks if a given part should have a numeric value.\n * @param part - A part to check\n */\nexport function isNumeric(part: Part) {\n  return [\"numeric\", \"2-digit\"].includes(part.partValue)\n}\n\n/**\n * Validates that an array of Parts can be parsed.\n * @param parts - Parts to validate for parsing ability.\n */\nexport function validate(parts: Part[]): Part[] | never {\n  let lastPart: Part | undefined = undefined\n  for (const part of parts) {\n    if (part.partName === \"literal\" && !isNaN(parseFloat(part.partValue))) {\n      throw new Error(`Numbers in format (${part.partValue}).`)\n    }\n    if (lastPart && lastPart.partName !== \"literal\" && part.partName !== \"literal\") {\n      if (\n        !(lastPart.token in fixedLength) &&\n        !(part.token in fixedLength) &&\n        !(isNumeric(lastPart) && part.token.toLowerCase() === \"a\") &&\n        lastPart.token !== \"SSS\" // SSS can be followed by anything (greedy digit consumer)\n      ) {\n        throw new Error(`Illegal adjacent tokens (${lastPart.token}, ${part.token})`)\n      }\n    }\n    lastPart = part\n  }\n  return parts\n}\n\n/**\n * Returns the timezone token format from a given format.\n * @param format - The format to check.\n * @returns The timezone token format (\"Z\" or \"ZZ\").\n */\nexport function getOffsetFormat(format: Format): TimezoneToken {\n  if (typeof format === \"string\") {\n    return format.includes(\"ZZ\") ? \"ZZ\" : \"Z\"\n  }\n  return \"time\" in format && format.time === \"full\" ? \"Z\" : \"ZZ\"\n}\n","import { dayPeriodMap, specDate, normStr } from \"./common\"\n\n/**\n * Determines the correct value for am/pm by locale and memoizes it.\n * @param ampm - am or pm\n * @param locale - The locale to fetch.\n */\nexport function ap(ampm: \"am\" | \"pm\", locale: string): string {\n  const l = dayPeriodMap.get(locale)\n  if (l && l[ampm]) return l[ampm] as string\n  const specimen = new Date(specDate)\n  specimen.setUTCHours(ampm === \"am\" ? 5 : 20)\n  const subparts = new Intl.DateTimeFormat(locale, {\n    timeStyle: \"full\",\n    timeZone: \"UTC\",\n    hour12: true,\n  })\n    .formatToParts(specimen)\n    .map(normStr)\n  const period = subparts.find((part) => part.type === \"dayPeriod\")\n  if (period) {\n    const localePeriods: { am?: string; pm?: string } = l || {}\n    dayPeriodMap.set(\n      locale,\n      Object.assign(localePeriods, { [ampm]: period.value })\n    )\n    return period.value\n  }\n  return ampm\n}\n","import { date } from \"./date\"\nimport { TimezoneToken, fixedLengthByOffset, offsetToSecs } from \"./common\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Apply a given offset to a date, returning a new date with the offset\n * applied by adding or subtracting the given number of seconds.\n * @param [dateInput] - The date to apply the offset to. (default: current time)\n * @param [offset] - The offset to apply in the +-HHmm, +-HH:mm, +-HHmmss, or +-HH:mm:ss format.\n */\nexport function applyOffset(dateInput?: MaybeDateInput, offset = \"+00:00\"): Date {\n  const d = date(dateInput)\n  const len = fixedLengthByOffset(offset)\n  // 5 or 8 chars = no colons (ZZ format), 6 or 9 chars = with colons (Z format)\n  const token: TimezoneToken = len === 5 || len === 8 ? \"ZZ\" : \"Z\"\n  const timeDiffInSecs = offsetToSecs(offset, token)\n  return new Date(d.getTime() + timeDiffInSecs * 1000)\n}\n","/**\n * Get the timezone of the device.\n *\n * * Note: If the environment variable TZ is not set, it will return undefined.\n */\nexport function deviceTZ(): string | undefined {\n  return Intl.DateTimeFormat().resolvedOptions().timeZone as string | undefined\n}\n","import { date } from \"./date\"\nimport { normStr, secsToOffset, TimezoneToken } from \"./common\"\nimport { deviceTZ } from \"./deviceTZ\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Converts a date object from one timezone to that same time in UTC. This is\n * only for internal use.\n * @param d - A Date object\n * @param timeZone - A timezone string\n */\nfunction relativeTime(d: Date, timeZone: string): Date {\n  const utcParts = new Intl.DateTimeFormat(\"en-US\", {\n    year: \"numeric\",\n    month: \"2-digit\",\n    day: \"2-digit\",\n    hour: \"2-digit\",\n    minute: \"2-digit\",\n    second: \"2-digit\",\n    timeZone,\n    hourCycle: \"h23\",\n  })\n    .formatToParts(d)\n    .map(normStr)\n  const parts: {\n    year?: string\n    month?: string\n    day?: string\n    hour?: string\n    minute?: string\n    second?: string\n  } = {}\n  utcParts.forEach((part) => {\n    parts[part.type as keyof typeof parts] = part.value\n  })\n  return new Date(\n    `${parts.year}-${parts.month}-${parts.day}T${parts.hour}:${parts.minute}:${parts.second}Z`\n  )\n}\n\n/**\n * Returns the offset between two timezones on a given date. The results are\n * ISO8601 compatible offsets like -0800 or +0530.\n *\n * @param [dateInput] - (default: current time) The date on which to determine the offset\n * @param [tzA] - (default: UTC) The second timezone to compare determine the offset between.\n * @param [tzB] - (default: device) The first timezone to compare determine the offset between.\n */\nexport function offset(\n  utcTime?: MaybeDateInput,\n  tzA = \"UTC\",\n  tzB = \"device\",\n  timeZoneToken: TimezoneToken = \"Z\"\n): string {\n  tzB = tzB === \"device\" ? deviceTZ() ?? \"utc\" : tzB\n  const d = date(utcTime)\n  const timeA = relativeTime(d, tzA)\n  const timeB = relativeTime(d, tzB)\n  const timeDiffInSecs = Math.round((timeB.getTime() - timeA.getTime()) / 1000)\n  return secsToOffset(timeDiffInSecs, timeZoneToken)\n}\n","import { offset } from \"./offset\"\nimport { applyOffset } from \"./applyOffset\"\nimport { date } from \"./date\"\nimport { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Creates a date object for the input date at the given timezone. For example\n * `tzDate(\"2017-05-06T12:00\", \"Europe/Amsterdam\")` will return a date object\n * for 2017-05-06T10:00:00Z since 12:00 in Amsterdam is 10:00Z.\n *\n * If given a Date object it will use local time and convert it to the given\n * timezone, thus \"changing\" the date.\n *\n * if given no string or date object, it'll use the current locale time and convert to the given timezone\n * @param [inputDate] - An iso8601 date string with no timezone\n * @param tz - A timezone string\n */\nexport function tzDate(inputDate: MaybeDateInput, tz: string) {\n  const d = date(inputDate)\n  return applyOffset(d, offset(d, tz))\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Gets the what day of the year a given date is. For example, August 1st is\n * the 213th day of the year on non- years and 214th on leap years.\n * @param [inputDate] - The input date or nothing for the current day.\n */\nexport function dayOfYear(inputDate?: MaybeDateInput): number {\n  const d = date(inputDate)\n  return Math.round(\n    (new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0).getTime() -\n      new Date(d.getFullYear(), 0, 0).getTime()) /\n      86400000\n  )\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for end of the given day.\n * @param [inputDate] - A string, Date object or nothing for the current day\n */\nexport function dayEnd(inputDate?: MaybeDateInput): Date {\n  const d = date(inputDate)\n  d.setHours(23, 59, 59, 999)\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for start of the given day.\n * @param [inputDate] - A string, Date object or nothing for the current day\n */\nexport function dayStart(inputDate?: MaybeDateInput): Date {\n  const d = date(inputDate)\n  d.setHours(0, 0, 0, 0)\n  return d\n}\n","import {\n  styles,\n  normStr,\n  tokens,\n  memoParts,\n  clockAgnostic,\n  clock24,\n  specDate,\n  clock12,\n  fractionalSeconds,\n} from \"./common\"\nimport type {\n  ParseOptions,\n  Format,\n  Part,\n  FormatStyle,\n  FormatStyleObj,\n  FormatPattern,\n  NamedFormats,\n  NamedFormatOption,\n} from \"./types\"\n/**\n * Given a format string, produce an array of matching \"parts\", each part\n * contains a regular expression and the corresponding\n * Intl.DateTimeFormatPartTypesRegistry key/value.\n * @param format - A format string like MM/DD/YYYY\n * @param locale - The locale to parse for.\n */\nexport function parts(format: Format, locale: string): Part[] {\n  if (styles.includes(format as FormatStyle) || typeof format === \"object\") {\n    return styleParts(format as FormatStyle | FormatStyleObj, locale)\n  }\n  let f = format\n  let match = 0\n  const testPattern = (pattern: FormatPattern) => {\n    if (!pattern[2]) pattern[2] = new RegExp(`(.)?(${pattern[0]})`, \"g\")\n    if (pattern[2].test(f)) {\n      let didAdd = 0\n      f = f.replace(pattern[2], (_, prefix, actualMatch) => {\n        if (prefix === \"\\\\\") return actualMatch\n        return `${typeof prefix === \"string\" ? prefix : \"\"}{!${\n          didAdd++ ? match : match++\n        }!}`\n      })\n      return !!didAdd\n    }\n    return false\n  }\n\n  function validate(patterns: Part[]): Part[] {\n    const parts = patterns.map((part) => part.partName)\n    const deduped = new Set(parts)\n    if (parts.length > deduped.size) {\n      throw new Error(`Cannot reuse format tokens.`)\n    }\n    return patterns\n  }\n\n  function createPart(\n    hour12: boolean,\n    [token, option, exp]: FormatPattern\n  ): Part {\n    const partName = Object.keys(option)[0] as Intl.DateTimeFormatPartTypes\n    const partValue = option[partName] as string\n    return {\n      option,\n      partName,\n      partValue,\n      token,\n      pattern: exp as RegExp,\n      hour12,\n    }\n  }\n\n  const found24Patterns = clockAgnostic\n    .filter(testPattern)\n    .concat(clock24.filter(testPattern))\n    .concat(fractionalSeconds.filter(testPattern))\n    .map(createPart.bind(null, false))\n\n  // Reset the format before re-checking\n  const parts = validate(\n    found24Patterns.concat(\n      clock12.filter(testPattern).map(createPart.bind(null, true))\n    )\n  )\n  const extractIndex = /^\\{!(\\d+)!\\}$/\n  return f\n    .split(/(\\{!\\d+!\\})/)\n    .map((match: string): Part => {\n      const hasIndex = match.match(extractIndex)\n      if (hasIndex) {\n        return parts[Number(hasIndex[1])]\n      }\n      return {\n        option: { literal: match },\n        partName: \"literal\",\n        partValue: match,\n        token: match,\n        pattern: new RegExp(\"\"),\n        hour12: false,\n      }\n    })\n    .filter((part) => !(part.partName === \"literal\" && part.partValue === \"\"))\n}\n\n/**\n * Determines the parts in a native date style, like \"full\".\n * @param format - A date style like \"full\" or \"short\"\n * @param locale - The locale string\n */\nfunction styleParts(\n  format: FormatStyle | FormatStyleObj,\n  locale: string\n): Part[] {\n  const options: Intl.DateTimeFormatOptions = {\n    timeZone: \"UTC\",\n  }\n  if (typeof format === \"string\") {\n    options.dateStyle = format\n  } else {\n    if (\"date\" in format) options.dateStyle = format.date\n    if (\"time\" in format) options.timeStyle = format.time\n  }\n\n  const formatter = new Intl.DateTimeFormat(locale, options)\n  const segments = formatter.formatToParts(new Date(specDate)).map(normStr)\n  const hourTypeSegments = formatter\n    .formatToParts(new Date(\"1999-04-05T23:05:01.000Z\"))\n    .map(normStr)\n  const hourPart = hourTypeSegments.find((segment) => segment.type === \"hour\")\n  const hourType = hourPart && hourPart.value === \"23\" ? 24 : 12\n  return segments\n    .map((part): Part | undefined => {\n      const partName = part.type\n      const formatPattern = guessPattern(\n        part.type,\n        part.value,\n        locale,\n        part.type === \"hour\" ? hourType : undefined,\n        options\n      )\n      if (formatPattern === undefined) return\n      const partValue = formatPattern[1][partName]\n      if (!partValue) return\n      if (!formatPattern[2])\n        formatPattern[2] = new RegExp(`${formatPattern[0]}`, \"g\")\n      return {\n        option: { [partName]: partValue },\n        partName,\n        partValue,\n        token: formatPattern[0],\n        pattern: formatPattern[2],\n        hour12: hourType === 12,\n      }\n    })\n    .filter((part): part is Part => !!part)\n}\n\n/**\n * Attempts to guess the correct part value type for a given dateStyle. For\n * example a month of 02 would be \"2-digit\".\n *\n * @param partName - The part name to guess for, like 'year' or 'month'\n * @param partValue - The current value, it is assumed this is the smallest denom.\n */\nfunction guessPattern<T extends Intl.DateTimeFormatPartTypes>(\n  partName: T,\n  partValue: string,\n  locale: string,\n  hour: T extends \"hour\" ? 12 | 24 : undefined,\n  options: Intl.DateTimeFormatOptions\n): FormatPattern | undefined {\n  const l = partValue.length\n  const n = !isNaN(Number(partValue))\n  let style: NamedFormatOption | undefined\n  /* eslint-disable @typescript-eslint/no-non-null-assertion */\n  switch (partName) {\n    case \"year\":\n      return l === 2 ? tokens.get(\"YY\") : tokens.get(\"YYYY\")\n    case \"month\":\n      if (n) return l === 1 ? tokens.get(\"M\") : tokens.get(\"MM\")\n      style = partStyle(locale, partName, partValue)\n      switch (style) {\n        case \"long\":\n          return tokens.get(\"MMMM\")\n        default:\n          return tokens.get(\"MMM\")\n      }\n    case \"day\":\n      return l === 1 ? tokens.get(\"D\") : tokens.get(\"DD\")\n    case \"weekday\":\n      style = partStyle(locale, partName, partValue)\n      switch (style) {\n        case \"narrow\":\n          return tokens.get(\"d\")\n        case \"short\":\n          return tokens.get(\"ddd\")\n        default:\n          return tokens.get(\"dddd\")\n      }\n    case \"hour\":\n      // Need to distinguish the locale’s default as 24 or 12 hour.\n      if (hour === 12) return l === 1 ? tokens.get(\"h\") : tokens.get(\"hh\")\n      return l === 1 ? tokens.get(\"H\") : tokens.get(\"HH\")\n    case \"minute\":\n      return l === 1 ? tokens.get(\"m\") : tokens.get(\"mm\")\n    case \"second\":\n      return l === 1 ? tokens.get(\"s\") : tokens.get(\"ss\")\n    case \"dayPeriod\":\n      return /^[A-Z]+$/u.test(partValue) ? tokens.get(\"A\") : tokens.get(\"a\")\n    case \"literal\":\n      return [partValue, { literal: partValue }, new RegExp(\"\")]\n    case \"timeZoneName\":\n      return options.timeStyle === \"full\" ? tokens.get(\"Z\") : tokens.get(\"ZZ\")\n    default:\n      return undefined\n  }\n  /* eslint-enable @typescript-eslint/no-non-null-assertion */\n}\n\n/**\n * Determines what \"style\" a given part is in. For example, if you provide:\n * ```js\n * partStyle('en', 'month', 'Jan')\n * // returns \"short\".\n * ```\n * Part styles are always expected to be \"genitive\" — for use in \"dateStyle\".\n * @param locale - Locale string\n * @param part - The part to attempt a lookup on\n * @param value - The value of a given part.\n */\nfunction partStyle(\n  locale: string,\n  part: keyof NamedFormats,\n  value: string\n): NamedFormatOption | undefined {\n  if (!memoParts.has(locale)) {\n    const date = new Date(specDate)\n    const weekdays = [3, 8, 9, 7, 6, 4, 3]\n    const parts = [\"weekday\", \"month\", \"dayPeriod\"]\n    const partStyles: NamedFormatOption[] = [\"long\", \"short\", \"narrow\"]\n    const formats: Partial<NamedFormats> = {}\n    for (let i = 0; i < 12; i++) {\n      date.setMonth(0 + i)\n      if (i in weekdays) date.setDate(weekdays[i])\n      date.setUTCHours(8 + i)\n      for (const style of partStyles) {\n        const segments = new Intl.DateTimeFormat(\n          locale,\n          parts.reduce(\n            (options, part) => Object.assign(options, { [part]: style }),\n            { hour12: true, timeZone: \"UTC\" }\n          )\n        )\n          .formatToParts(date)\n          .map(normStr)\n        if (style === \"long\" || style === \"short\") {\n          const genitiveFormattedParts = new Intl.DateTimeFormat(locale, {\n            dateStyle: style === \"short\" ? \"medium\" : \"long\",\n            timeZone: \"UTC\",\n          })\n            .formatToParts(date)\n            .map(normStr)\n          const genitiveMonth = genitiveFormattedParts.find(\n            (part) => part.type === \"month\"\n          )\n          const index = segments.findIndex((part) => part.type === \"month\")\n          if (index > -1 && genitiveMonth) segments[index] = genitiveMonth\n        }\n        segments.forEach((part) => {\n          if (part.type === \"literal\") return\n          const type = part.type as keyof NamedFormats\n          formats[type] = Object.assign(formats[type] || {}, {\n            [part.value]: style,\n          })\n        })\n      }\n    }\n    memoParts.set(locale, formats as NamedFormats)\n  }\n  const formats = memoParts.get(locale)\n  return formats ? formats[part][value] : undefined\n}\n","import { applyOffset } from \"./applyOffset\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Inverts the offset and applies it to the given date, returning a new date.\n * @param [dateInput] - The date to remove the offset from. (default: current time)\n * @param [offset] - The offset to remove in the +-HHmm or +-HH:mm format.\n */\nexport function removeOffset(dateInput?: MaybeDateInput, offset = \"+00:00\"): Date {\n  const positive = offset.slice(0, 1) === \"+\"\n  return applyOffset(\n    dateInput,\n    offset.replace(positive ? \"+\" : \"-\", positive ? \"-\" : \"+\")\n  )\n}\n","/**\n * Returns the device's locale. This is a simple proxy of the\n * `Intl.DateTimeFormat().resolvedOptions().locale` call.\n */\nexport function deviceLocale() {\n  return Intl.DateTimeFormat().resolvedOptions().locale\n}\n","import { date } from \"./date\"\nimport { parts } from \"./parts\"\nimport { fill, getOffsetFormat } from \"./common\"\nimport type {\n  DateInput,\n  Format,\n  FormatOptions,\n  FormatStyle,\n  Part,\n} from \"./types\"\nimport { offset } from \"./offset\"\nimport { removeOffset } from \"./removeOffset\"\nimport { deviceLocale } from \"./deviceLocale\"\nimport { deviceTZ } from \"./deviceTZ\"\n\n/**\n * Produce a formatted string. Available strings:\n * token | description\n * ------|------------\n * YY | 2 digit year\n * YYYY | 4 digit year\n * M | The month 1-12\n * MM | The month 01-12\n * MMM | Short name Jan-Dec\n * MMMM | Full name January | December\n * D | The day of the month 1-31\n * DD | The day of the month 01-31\n * d | Single digit day \"T\"\n * ddd | Short day name Thu\n * dddd | Full day name Wednesday\n * H | Minimum hour digits, 24 hour, 0-23\n * HH | 2 hour digits, 24 hour, 00-23\n * h | Minimum hour digits, 12 hour clock, 1-12\n * hh | 2 hour digits, 12 hour clock, 01-12\n * m | The minute 0-59\n * mm | The minute 00-59\n * s | The second 0-59\n * ss | The second 00-59\n * a | am/pm\n * A | AM/PM\n * Z | +0800, +0530, -1345\n *\n * @param inputDate - A date object or ISO 8601 string\n * @param format - A format\n */\nexport function format(options: FormatOptions): string\nexport function format(\n  inputDate: DateInput,\n  format?: Format,\n  locale?: string,\n  genitive?: boolean,\n  partFilter?: (part: Part) => boolean\n): string\nexport function format(\n  inputDateOrOptions: DateInput | FormatOptions,\n  format: Format = \"long\",\n  locale: string | undefined = \"device\",\n  genitive: boolean | undefined = false,\n  partFilter?: (part: Part) => boolean\n): string {\n  let tz: string | undefined, forceOffset: string | undefined\n\n  if (\n    typeof inputDateOrOptions === \"object\" &&\n    !(inputDateOrOptions instanceof Date)\n  ) {\n    // Extract options from the object.\n    ;({\n      date: inputDateOrOptions,\n      format,\n      locale,\n      genitive,\n      partFilter,\n      tz,\n    } = inputDateOrOptions)\n  }\n  // ISO 8601 is a special case because it doesn't require a format.\n  if (format === \"ISO8601\") return date(inputDateOrOptions).toISOString()\n\n  if (tz) {\n    forceOffset = offset(inputDateOrOptions, \"utc\", tz, getOffsetFormat(format))\n  }\n\n  // We need to apply an offset to the date so that it can be formatted as UTC.\n  tz ??= deviceTZ()\n  if (tz?.toLowerCase() !== \"utc\") {\n    inputDateOrOptions = removeOffset(\n      inputDateOrOptions,\n      offset(inputDateOrOptions, tz, \"utc\")\n    )\n  }\n\n  if (!locale || locale === \"device\") {\n    locale = deviceLocale()\n  }\n\n  return fill(\n    inputDateOrOptions,\n    parts(format, locale).filter(partFilter ?? (() => true)),\n    locale,\n    genitive,\n    forceOffset\n  )\n    .map((p) => p.value)\n    .join(\"\")\n}\n","import { parts } from \"./parts\"\nimport { escapeTokens } from \"./common\"\nimport type { Format, Part } from \"./types\"\n\n/**\n * Return the string format for a given format. For example:\n * ```js\n * formatStr({ date: 'long' }, 'en') // dddd, MMMM D, YYYY\n * ```\n * @param format - A format string or object.\n * @param locale - A locale or en by default.\n */\nexport function formatStr(\n  format: Format,\n  locale = \"en\",\n  escapeLiterals = false,\n  filterParts: (part: Part) => boolean = () => true\n): string {\n  return parts(format, locale)\n    .filter(filterParts)\n    .reduce(\n      (f, p) =>\n        (f +=\n          escapeLiterals && p.partName === \"literal\"\n            ? escapeTokens(p.token)\n            : p.token),\n      \"\"\n    )\n    .normalize(\"NFKC\")\n}\n","/**\n * Converts a 2 digit year into a 4 digit year. This function assumes years 20\n * years into the future belong to the current century, and the past 80 are in\n * the past.\n *\n * @param value - 2 digits in string format\n */\nexport function fourDigitYear(value: string): number {\n  const y = new Date().getFullYear()\n  const currentYear = y % 100\n  const century = Math.floor(y / 100)\n  const parsedYear = Number(value)\n  return (century + (parsedYear > currentYear + 20 ? -1 : 0)) * 100 + parsedYear\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for end of the given hour.\n * @param [inputDate] - A string, Date object or nothing for the current time\n */\nexport function hourEnd(inputDate?: MaybeDateInput): Date {\n  const d = date(inputDate)\n  d.setMinutes(59, 59, 999)\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for start of the given hour.\n * @param [inputDate] - A string, Date object or nothing for the current time\n */\nexport function hourStart(inputDate?: MaybeDateInput): Date {\n  const d = date(inputDate)\n  d.setMinutes(0, 0, 0)\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for end of the given minute.\n * @param [inputDate] - A string, Date object or nothing for the current time\n */\nexport function minuteEnd(inputDate?: MaybeDateInput): Date {\n  const d = date(inputDate)\n  d.setSeconds(59, 999)\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for start of the given minute.\n * @param [inputDate] - A string, Date object or nothing for the current time\n */\nexport function minuteStart(inputDate?: MaybeDateInput): Date {\n  const d = date(inputDate)\n  d.setSeconds(0, 0)\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for the first day of a month.\n * @param [inputDate] - A string, Date object or nothing for the current time\n */\nexport function monthStart(inputDate?: MaybeDateInput): Date {\n  const d = date(inputDate)\n  d.setDate(1)\n  d.setHours(0, 0, 0, 0)\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Get the number of days in the given date’s year.\n * @param [inputDate] -  A string, Date object or nothing for the current year\n */\nexport function yearDays(inputDate?: MaybeDateInput): number {\n  const d = date(inputDate)\n  return (\n    (new Date(d.getFullYear() + 1, 0, 0).getTime() -\n      new Date(d.getFullYear(), 0, 0).getTime()) /\n    86400000\n  )\n}\n","import { date } from \"./date\"\nimport { monthDays } from \"./monthDays\"\nimport { yearDays } from \"./yearDays\"\nimport { dayOfYear } from \"./dayOfYear\"\nimport { addDay } from \"./addDay\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Performs a bidirectional search for the nearest date that passes a function.\n * @param [inputDate] - Performs a search for the nearest passing date.\n * @param search - The search function to use, given a date returns a boolean.\n * @param constraint - The number of iterations to perform before giving up, or logical constraint like \"month\", or \"week\".\n *\n */\nexport function nearestDay(\n  inputDate: MaybeDateInput,\n  search: (date: Date) => boolean,\n  constraint: number | \"month\" | \"week\" | \"year\" = 7\n): Date | null {\n  let increments: number\n  let decrements: number\n  const d = date(inputDate)\n  switch (constraint) {\n    case \"month\":\n      decrements = d.getDate()\n      increments = monthDays(d) - d.getDate()\n      break\n    case \"week\":\n      decrements = d.getDay() + 1\n      increments = 6 - d.getDay()\n      break\n    case \"year\":\n      const total = yearDays(d)\n      const day = dayOfYear(d)\n      decrements = day\n      increments = total - day\n      break\n    default:\n      increments = decrements = constraint\n  }\n\n  for (let i = 0; i <= increments || i < decrements; i++) {\n    if (i <= increments) {\n      const next = addDay(d, i)\n      if (search(next)) return next\n    }\n    if (i && i <= decrements) {\n      const prev = addDay(d, -i)\n      if (search(prev)) return prev\n    }\n  }\n  return null\n}\n","import { format } from \"./format\"\nimport { ap } from \"./ap\"\nimport type { FormatToken } from \"./types\"\n/**\n * Returns an array of options for a given token in a given locale.\n * @param token - Get the full range of options for a given token\n * @param locale - The locale to fetch the options for.\n */\nexport function range(\n  token: FormatToken,\n  locale = \"en\",\n  genitive = false\n): string[] {\n  const r: (n: number, c: (index: number) => string | number) => string[] = (\n    n,\n    c\n  ) =>\n    Array(n)\n      .fill(\"\")\n      .map((_, i) => `${c(i)}`)\n\n  if (token === \"M\") return r(12, (i) => i + 1)\n  if (token === \"MM\")\n    return r(12, (i) => {\n      const m = i + 1\n      return m < 10 ? `0${m}` : m\n    })\n  // MMM and MMMM\n  if (token.startsWith(\"M\"))\n    return range(\"MM\").map((m) =>\n      format(`2000-${m}-05`, token, locale, genitive)\n    )\n  if (token.startsWith(\"d\"))\n    return r(7, (i) => `0${i + 2}`).map((d) =>\n      format(`2022-10-${d}`, token, locale)\n    )\n  if (token === \"a\")\n    return [ap(\"am\", locale).toLowerCase(), ap(\"pm\", locale).toLowerCase()]\n  if (token === \"A\")\n    return [ap(\"am\", locale).toUpperCase(), ap(\"pm\", locale).toUpperCase()]\n  if (token.startsWith(\"Y\")) {\n    const year = new Date().getFullYear()\n    return r(120, (i) => i + 1).reduce(\n      (ranges, i) => {\n        if (i !== \"120\")\n          ranges.push(format(`${year + Number(i)}-06-06`, token, locale))\n        ranges.unshift(format(`${year - Number(i)}-06-06`, token, locale))\n        return ranges\n      },\n      [format(`${year}-06-06`, token, locale)]\n    )\n  }\n  if (token.startsWith(\"D\"))\n    return r(31, (i) => `${token === \"DD\" && i < 9 ? \"0\" : \"\"}${i + 1}`)\n  if (token.startsWith(\"H\"))\n    return r(24, (i) => `${token === \"HH\" && i < 10 ? \"0\" : \"\"}${i}`)\n  if (token.startsWith(\"h\"))\n    return r(12, (i) => `${token === \"hh\" && i < 9 ? \"0\" : \"\"}${i + 1}`)\n  if (token.startsWith(\"m\") || token.startsWith(\"s\"))\n    return r(60, (i) => `${token.length > 1 && i < 10 ? \"0\" : \"\"}${i}`)\n  return []\n}\n","import { date } from \"./date\"\nimport { validate, styles, fixedLength, four, two, validOffset, fixedLengthByOffset, offsetToSecs, TimezoneToken } from \"./common\"\nimport { formatStr } from \"./formatStr\"\nimport { fourDigitYear } from \"./fourDigitYear\"\nimport { ap } from \"./ap\"\nimport { range } from \"./range\"\nimport { monthDays } from \"./monthDays\"\nimport { parts } from \"./parts\"\nimport type {\n  ParseOptions,\n  Format,\n  Part,\n  FormatStyle,\n  FilledPart,\n  FormatToken,\n} from \"./types\"\n\nexport function parse(options: ParseOptions): Date | never\nexport function parse(\n  dateStr: string,\n  format?: Format,\n  locale?: string\n): Date | never\n/**\n * Parses a date string into a Date object using the given format.\n * @param dateStr - A string representing a date.\n * @param format - The format the given string is in.\n * @param locale - The locale to parse the string from.\n */\nexport function parse(\n  dateStrOrOptions: string | ParseOptions,\n  format: Format = \"ISO8601\",\n  locale = \"device\"\n): Date | never {\n  let partFilter: (part: Part) => boolean = () => true\n  let dateStr: string\n  let dateOverflow = \"backward\"\n  if (typeof dateStrOrOptions === \"object\") {\n    ;({\n      date: dateStr,\n      format = \"ISO8601\",\n      locale = \"device\",\n      dateOverflow = \"backward\",\n      partFilter = () => true,\n    } = dateStrOrOptions)\n  } else {\n    dateStr = dateStrOrOptions\n  }\n  if (!dateStr) throw new Error(\"parse() requires a date string.\")\n  const invalid = (): never => {\n    throw new Error(\n      `Date (${dateStr}) does not match format (${formatStr(format, locale)})`\n    )\n  }\n  if (format === \"ISO8601\") return date(dateStr)\n  const genitive =\n    styles.includes(format as FormatStyle) || typeof format === \"object\"\n  const formatParts = validate(parts(format, locale).filter(partFilter))\n  if (!formatParts.length) throw new Error(\"parse() requires a pattern.\")\n  let parsedParts\n  try {\n    parsedParts = parseParts(dateStr, formatParts)\n  } catch {\n    return invalid()\n  }\n  const now = new Date()\n  const parsed = new Map([\n    [\"YYYY\", now.getFullYear()],\n    [\"MM\", now.getMonth() + 1],\n    [\"DD\", now.getDate()],\n    [\"HH\", 0],\n    [\"mm\", 0],\n    [\"ss\", 0],\n    [\"SSS\", 0],\n  ])\n  let a: null | boolean = null\n  let offset = \"\"\n  parsedParts.forEach((part): void | never => {\n    if (part.partName === \"literal\") return\n    if (part.token === part.value) return invalid()\n    const v = Number(part.value)\n    // Handle SSS specially - convert variable-length fractional seconds to milliseconds\n    if (part.token === \"SSS\") {\n      // \"1\" -> 100, \"12\" -> 120, \"123\" -> 123, \"123456\" -> 123\n      const digits = part.value.padEnd(3, \"0\").slice(0, 3)\n      parsed.set(\"SSS\", Number(digits))\n    } else if (parsed.has(part.token)) {\n      // Parse for YYYY, MM, DD, HH, hh, mm, ss\n      parsed.set(part.token, v)\n    } else if (part.token === \"YY\") {\n      // Parse for YY\n      parsed.set(\"YYYY\", fourDigitYear(part.value))\n    } else {\n      /* MMM - Short name Jan-Dec\n       * MMMM - Full name January - December\n       * h - Minimum hour digits, 12 hour clock, 1-12\n       * hh - 2 hour digits, 12 hour clock, 01-12\n       * m - The minute 0-59\n       * mm - The minute 00-12\n       * s - The second 0-59\n       * a - am/pm\n       * A - AM/PM\n       */\n      const t = part.token\n      if (t.startsWith(\"d\")) {\n        // d, ddd, dddd — we just ignore these because they are non specific\n        return\n      } else if (t === \"D\") {\n        parsed.set(\"DD\", v)\n      } else if (t === \"H\" || t.startsWith(\"h\")) {\n        parsed.set(\"HH\", v)\n      } else if (t === \"M\") {\n        parsed.set(\"MM\", v)\n      } else if (t === \"a\" || t === \"A\") {\n        a = part.value.toLowerCase() === ap(\"am\", locale).toLowerCase()\n      } else if (t === \"Z\" || t === \"ZZ\") {\n        offset = validOffset(part.value, t)\n      } else {\n        const values = range(t as FormatToken, locale, genitive)\n        const index = values.indexOf(part.value)\n        if (index !== -1) {\n          switch (t) {\n            case \"MMM\":\n            case \"MMMM\":\n              parsed.set(\"MM\", index + 1)\n              break\n          }\n        }\n      }\n    }\n  })\n  let hours = parsed.get(\"HH\") || 0\n  if (a === false) {\n    hours += hours === 12 ? 0 : 12\n    parsed.set(\"HH\", hours === 24 ? 0 : hours)\n  } else if (a === true && hours === 12) {\n    // 12am === 00 in 24 hour clock.\n    parsed.set(\"HH\", 0)\n  }\n  parsed.set(\"MM\", (parsed.get(\"MM\") || 1) - 1)\n  // eslint-disable-next-line prefer-const\n  let [Y, M, D, h, m, s, ms] = Array.from(parsed.values())\n\n  // Determine if the date is valid for the month.\n  const maxDaysInMonth = monthDays(new Date(`${four(Y)}-${two(M + 1)}-10`))\n  if (maxDaysInMonth < D && dateOverflow === \"throw\")\n    throw new Error(`Invalid date ${four(Y)}-${two(M + 1)}-${two(D)}`)\n  D = dateOverflow === \"backward\" ? Math.min(D, maxDaysInMonth) : D\n\n  // Create the date.\n  // If there's an offset, we need to handle it manually because JavaScript's Date\n  // doesn't support seconds in timezone offsets (e.g., -05:32:11).\n  const msStr = String(ms).padStart(3, \"0\")\n  if (offset) {\n    // Create the date in UTC, then apply the offset manually\n    const isoStringUtc = `${four(Y)}-${two(M + 1)}-${two(D)}T${two(h)}:${two(m)}:${two(s)}.${msStr}Z`\n    const d = new Date(isoStringUtc)\n    if (!isFinite(+d)) return invalid()\n\n    const len = fixedLengthByOffset(offset)\n    const token: TimezoneToken = len === 5 || len === 8 ? \"ZZ\" : \"Z\"\n    const offsetSecs = offsetToSecs(offset, token)\n    return new Date(d.getTime() - offsetSecs * 1000)\n  }\n\n  // No offset - create date in local time (original behavior)\n  const isoString = `${four(Y)}-${two(M + 1)}-${two(D)}T${two(h)}:${two(m)}:${two(s)}.${msStr}`\n  const d = new Date(isoString)\n  if (isFinite(+d)) return d\n  return invalid()\n}\n\n/**\n * Given a string date and corresponding format parts, fill the parts with the\n * data from the string.\n * @param dateStr - A string to parse.\n * @param formatParts - The expected parts of the given string.\n */\nexport function parseParts(dateStr: string, formatParts: Part[]): FilledPart[] {\n  let i = 0\n  const advance = (parts: Part[]): [Part, Part | undefined] => [\n    parts[i++],\n    parts[i],\n  ]\n  let pos = 0\n  const parsed: FilledPart[] = []\n  let n: undefined | Part = undefined\n  do {\n    const [current, next] = advance(formatParts)\n    n = next\n    let len = 1\n    if (current.partName === \"literal\") {\n      // Literals can be discarded\n      len = current.partValue.length\n    } else if (current.partName === \"timeZoneName\") {\n      len = fixedLengthByOffset(dateStr.substring(pos))\n    } else if (current.token === \"SSS\") {\n      // Variable length: consume all consecutive digits (gracious parsing)\n      let end = pos\n      while (end < dateStr.length && /\\d/.test(dateStr.charAt(end))) {\n        end++\n      }\n      len = end - pos\n    } else if (current.token in fixedLength) {\n      // Fixed length parse\n      len = fixedLength[current.token as keyof typeof fixedLength]\n    } else if (next) {\n      // Variable length parse.\n      if (next.partName === \"literal\") {\n        len = dateStr.indexOf(next.partValue, pos) - pos\n        if (len < 0) throw new Error()\n      } else if (next.partName === \"dayPeriod\") {\n        // Our validator is ensuring that the current item must be a variable\n        // length number. We need to extract it.\n        for (let i = 1; i <= 4; i++) {\n          if (isNaN(Number(dateStr.charAt(pos + i)))) {\n            len = i\n            break\n          }\n        }\n      } else {\n        // Our validator guarantees the next is either not a number or it\n        // will be the end of the string\n        const nextChar = dateStr.substring(pos).search(/\\d/)\n        if (nextChar !== -1) len = pos + nextChar\n      }\n    } else {\n      len = dateStr.length\n    }\n\n    parsed.push({ ...current, value: dateStr.substring(pos, pos + len) })\n    pos += len\n  } while (n)\n  return parsed\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Checks if two date objects refer to the same date. Ignores time.\n * @param inputDateA - First date to compare\n * @param [inputDateB] - Second date to compare or the current time if nothing given\n */\nexport function sameDay(inputDateA: DateInput, inputDateB?: MaybeDateInput): boolean\n/**\n * Checks if two date objects refer to the same date. Ignores time.\n * @param [inputDateA] - First date to compare or the current time if null given\n * @param inputDateB - Second date to compare\n */\nexport function sameDay(inputDateA: MaybeDateInput, inputDateB: DateInput): boolean\nexport function sameDay(\n  inputDateA: MaybeDateInput,\n  inputDateB?: MaybeDateInput\n): boolean {\n  const a = date(inputDateA)\n  const b = date(inputDateB)\n  return (\n    a.getDate() === b.getDate() &&\n    a.getMonth() === b.getMonth() &&\n    a.getFullYear() === b.getFullYear()\n  )\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Checks if two date objects refer to the same time seconds. Ignores date.\n * @param inputDateA - First date to compare\n * @param [inputDateB] - Second date to compare or the current time if nothing given\n */\nexport function sameSecond(inputDateA: DateInput, inputDateB?: MaybeDateInput): boolean\n/**\n * Checks if two date objects refer to the same time seconds. Ignores date.\n * @param [inputDateA] - First date to compare or the current time if null given\n * @param inputDateB - Second date to compare\n */\nexport function sameSecond(inputDateA: MaybeDateInput, inputDateB: DateInput): boolean\nexport function sameSecond(\n  inputDateA: MaybeDateInput,\n  inputDateB?: MaybeDateInput\n): boolean {\n  const a = date(inputDateA)\n  const b = date(inputDateB)\n  return a.getSeconds() === b.getSeconds()\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Checks if two date objects refer to the same millisecond. Ignores date.\n * @param inputDateA - First date to compare\n * @param [inputDateB] - Second date to compare or the current time if nothing given\n */\nexport function sameMillisecond(inputDateA: DateInput, inputDateB?: MaybeDateInput): boolean\n/**\n * Checks if two date objects refer to the same millisecond. Ignores date.\n * @param [inputDateA] - First date to compare or the current time if null given\n * @param inputDateB - Second date to compare\n */\nexport function sameMillisecond(inputDateA: MaybeDateInput, inputDateB: DateInput): boolean\nexport function sameMillisecond(\n  inputDateA: MaybeDateInput,\n  inputDateB?: MaybeDateInput\n): boolean {\n  const a = date(inputDateA)\n  const b = date(inputDateB)\n  return a.getMilliseconds() === b.getMilliseconds()\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Checks if two date objects refer to the same time minutes. Ignores date.\n * @param inputDateA - First date to compare\n * @param [inputDateB] - Second date to compare or the current time if nothing given\n */\nexport function sameMinute(inputDateA: DateInput, inputDateB?: MaybeDateInput): boolean\n/**\n * Checks if two date objects refer to the same time minutes. Ignores date.\n * @param [inputDateA] - First date to compare or the current time if null given\n * @param inputDateB - Second date to compare\n */\nexport function sameMinute(inputDateA: MaybeDateInput, inputDateB: DateInput): boolean\nexport function sameMinute(\n  inputDateA: MaybeDateInput,\n  inputDateB?: MaybeDateInput\n): boolean {\n  const a = date(inputDateA)\n  const b = date(inputDateB)\n  return a.getMinutes() === b.getMinutes()\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Checks if two date objects refer to the same time hour. Ignores date.\n * @param inputDateA - First date to compare\n * @param [inputDateB] - Second date to compare or the current time if nothing given\n */\nexport function sameHour(inputDateA: DateInput, inputDateB?: MaybeDateInput): boolean\n/**\n * Checks if two date objects refer to the same time hour. Ignores date.\n * @param [inputDateA] - First date to compare or the current time if null given\n * @param inputDateB - Second date to compare\n */\nexport function sameHour(inputDateA: MaybeDateInput, inputDateB: DateInput): boolean\nexport function sameHour(\n  inputDateA: MaybeDateInput,\n  inputDateB?: MaybeDateInput\n): boolean {\n  const a = date(inputDateA)\n  const b = date(inputDateB)\n  return a.getHours() === b.getHours()\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Checks if two date objects refer to the same year.\n * @param inputDateA - First date to compare\n * @param [inputDateB] - Second date to compare or the current time if null given\n */\nexport function sameYear(inputDateA: DateInput, inputDateB?: MaybeDateInput): boolean\n/**\n * Checks if two date objects refer to the same year.\n * @param [inputDateA] - First date to compare or the current time if null given\n * @param inputDateB - Second date to compare\n */\nexport function sameYear(inputDateA: MaybeDateInput, inputDateB: DateInput): boolean\nexport function sameYear(\n  inputDateA: MaybeDateInput,\n  inputDateB?: MaybeDateInput\n): boolean {\n  const a = date(inputDateA)\n  const b = date(inputDateB)\n  return a.getFullYear() === b.getFullYear()\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for start of the given week. Defaults to Sunday as the\n * first day of the week:\n * 0 = Sunday ... 6 = Saturday\n * @param [inputDate] - A string, Date object or nothing for current week\n * @param [startOfWeekDay] - Determines which day of the week is the first\n */\nexport function weekStart(inputDate?: MaybeDateInput, startOfWeekDay = 0): Date {\n  const d = date(inputDate)\n  let diff = startOfWeekDay - d.getDay()\n  if (diff > 0) diff = diff - 7\n  d.setDate(d.getDate() + diff)\n  d.setHours(0, 0, 0, 0)\n  return d\n}\n","import { weekStart } from \"./weekStart\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for the last day at the last second of the given week.\n * Defaults to Sunday as the first day of the week:\n * 0 = Sunday ... 6 = Saturday\n * @param [inputDate] - Gets the last day of the week\n * @param [startOfWeekDay] - The first day of the week\n */\nexport function weekEnd(inputDate?: MaybeDateInput, startOfWeekDay = 0): Date {\n  const d = weekStart(inputDate, startOfWeekDay)\n  d.setDate(d.getDate() + 6)\n  d.setHours(23, 59, 59, 999)\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for the with the input date set to the start of the current year.\n * @param [inputDate] - A string, Date object or nothing for the current year\n */\nexport function yearStart(inputDate?: MaybeDateInput): Date {\n  const d = date(inputDate)\n\n  d.setMonth(0, 1)\n  d.setHours(0, 0, 0, 0)\n\n  return d\n}\n","import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for the with the input date set to the end of the current year.\n * @param [inputDate] - A string, Date object or nothing for the current year\n */\nexport function yearEnd(inputDate?: MaybeDateInput): Date {\n  const d = date(inputDate)\n\n  d.setMonth(11, 31)\n  d.setHours(23, 59, 59, 999)\n\n  return d\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Is the first date before the second one or the current time?\n *\n * @param inputDate - The date that should be before the other one to return true\n * @param [dateToCompare] - The date to compare with or the current time if nothing given\n *\n * @returns The first date is before the second date or the current time.\n */\nexport function isBefore(inputDate: DateInput, dateToCompare?: MaybeDateInput): boolean {\n  const _date = date(inputDate)\n  const _dateToCompare = date(dateToCompare)\n\n  return +_date < +_dateToCompare\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * @name isAfter\n * @category Common Helpers\n * @summary Is the first date after the second one or the current time?\n *\n * @description\n * Is the first date after the second one or the current time?\n *\n * @param inputDate - The date that should be after the other one to return true\n * @param [dateToCompare] - The date to compare with or the current time if nothing given\n *\n * @returns The first date is after the second date or the current time.\n */\nexport function isAfter(inputDate: DateInput, dateToCompare?: MaybeDateInput) {\n  const _date = date(inputDate)\n  const _dateToCompare = date(dateToCompare)\n\n  return +_date > +_dateToCompare\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Are the given dates equal or given date to the current time?\n *\n * @param dateLeft - The first date to compare\n * @param [dateRight] - The second date to compare or the current time of nothing given\n *\n * @returns The dates are equal or date to the current time\n */\nexport function isEqual(dateLeft: DateInput, dateRight?: MaybeDateInput): boolean\n/**\n * Are the given dates equal or given date to the current time?\n *\n * @param [dateLeft] - The first date to compare or the current time if null given\n * @param dateRight - The second date to compare\n *\n * @returns The dates are equal or date to the current time\n */\n\nexport function isEqual(dateLeft: MaybeDateInput, dateRight: DateInput): boolean\nexport function isEqual(dateLeft: MaybeDateInput, dateRight?: MaybeDateInput): boolean {\n  const _dateLeft = date(dateLeft)\n  const _dateRight = date(dateRight)\n\n  return +_dateLeft === +_dateRight\n}\n","import { isBefore } from \"./isBefore\"\nimport { DateInput } from \"./types\"\n\n/**\n * is the date in the past compared to the current time\n * @param inputDate - The date that should be in the past\n * @returns the given date is in the past compared to the current time\n */\nexport function isPast(inputDate: DateInput): boolean {\n  return isBefore(inputDate)\n}\n","import { isAfter } from \"./isAfter\"\nimport { DateInput } from \"./types\"\n\n/**\n * is the date in the future compared to the current time\n * @param inputDate - The date that should be in the future\n * @returns the given date is in the future compared to the current time\n */\nexport function isFuture(inputDate: DateInput): boolean {\n  return isAfter(inputDate)\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Returns the difference between 2 dates in milliseconds.\n * @param dateA - A date to compare with the right date\n * @param [dateB] - A date to compare with the left date or nothing to compare with the current time\n */\nexport function diffMilliseconds(dateA: DateInput, dateB?: MaybeDateInput): number\n\n/**\n * Returns the difference between 2 dates in milliseconds.\n * @param [dateA] - A date to compare with the right date or null to compare with the current time\n * @param dateB - A date to compare with the left date\n */\nexport function diffMilliseconds(dateA: MaybeDateInput, dateB: DateInput): number\n\nexport function diffMilliseconds(dateA: MaybeDateInput, dateB?: MaybeDateInput): number {\n  const left = date(dateA)\n  const right = date(dateB)\n  return +left - +right\n}\n","export type DiffRoundingMethod = \"trunc\" | \"round\" | \"floor\" | \"ceil\"\n\n/**\n * Return a rounded value with the given rounding method\n * @param value the value to round\n * @param method the rounding method\n */\nexport function diffRound(value: number, method: DiffRoundingMethod = \"trunc\") {\n  const r = Math[method](value)\n  return r == 0 ? 0 : r\n}\n","import { diffMilliseconds } from \"./diffMilliseconds\"\nimport { DiffRoundingMethod, diffRound } from \"./diffRound\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Returns the difference between 2 dates in seconds.\n * @param dateA - A date to compare with the right date\n * @param [dateB] - A date to compare with the left date or nothing to compare with the current time.\n * @param [roundingMethod] - the rounding method to use, default: trunc\n */\nexport function diffSeconds(\n  dateA: DateInput,\n  dateB?: MaybeDateInput,\n  roundingMethod?: DiffRoundingMethod\n): number\n\n/**\n * Returns the difference between 2 dates in seconds.\n * @param [dateA] - A date to compare with the right date or null to compare with the current time\n * @param dateB - A date to compare with the left date\n * @param [roundingMethod] - the rounding method to use, default: trunc\n */\nexport function diffSeconds(\n  dateA: MaybeDateInput,\n  dateB: DateInput,\n  roundingMethod?: DiffRoundingMethod\n): number\n\nexport function diffSeconds(\n  dateA: MaybeDateInput,\n  dateB?: MaybeDateInput,\n  roundingMethod?: DiffRoundingMethod\n): number {\n  return diffRound(\n    // @ts-ignore\n    diffMilliseconds(dateA, dateB) / 1000,\n    roundingMethod\n  )\n}\n","import type { DateInput, MaybeDateInput } from \"./types\"\nimport { diffMilliseconds } from \"./diffMilliseconds\"\nimport { diffRound, type DiffRoundingMethod } from \"./diffRound\"\n\n/**\n * Returns the difference between 2 dates in minutes.\n * @param dateA - A date to compare with the right date\n * @param [dateB] - A Date to compare with the left date or nothing to compare with the current time\n * @param [roundingMethod] the rounding method to use, default: trunc\n */\nexport function diffMinutes(\n  dateA: DateInput,\n  dateB?: MaybeDateInput,\n  roundingMethod?: DiffRoundingMethod\n): number\n\n/**\n * Returns the difference between 2 dates in minutes.\n * @param [dateA] - A date to compare with the right date or null to compare with the current time\n * @param dateB - A Date to compare with the left date\n * @param [roundingMethod] the rounding method to use, default: trunc\n */\nexport function diffMinutes(\n  dateA: DateInput,\n  dateB: DateInput,\n  roundingMethod?: DiffRoundingMethod\n): number\n\nexport function diffMinutes(\n  dateA: MaybeDateInput,\n  dateB?: MaybeDateInput,\n  roundingMethod?: DiffRoundingMethod\n): number {\n  return diffRound(\n    //@ts-ignore\n    diffMilliseconds(dateA, dateB) / 60_000,\n    roundingMethod\n  )\n}\n","import { diffMilliseconds } from \"./diffMilliseconds\"\nimport { diffRound, type DiffRoundingMethod } from \"./diffRound\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Returns the difference between 2 dates in hours.\n * @param dateA - A date to compare with the right date\n * @param [dateB] - A date to compare with the left date or nothing to compare with the current time\n * @param [roundingMethod] - the rounding method to use, default: trunc\n */\nexport function diffHours(\n  dateA: DateInput,\n  dateB?: MaybeDateInput,\n  roundingMethod?: DiffRoundingMethod\n): number\n\n/**\n * Returns the difference between 2 dates in hours.\n * @param [dateA] - A date to compare with the right date or null to compare with the current time\n * @param dateB - A date to compare with the left date\n * @param [roundingMethod] - the rounding method to use, default: trunc\n */\nexport function diffHours(\n  dateA: MaybeDateInput,\n  dateB: DateInput,\n  roundingMethod?: DiffRoundingMethod\n): number\n\nexport function diffHours(\n  dateA: MaybeDateInput,\n  dateB?: MaybeDateInput,\n  roundingMethod?: DiffRoundingMethod\n): number {\n  return diffRound(\n    //@ts-ignore\n    diffMilliseconds(dateA, dateB) / 3_600_000, // 1000 * 60 * 60\n    roundingMethod\n  )\n}\n","import { diffMilliseconds } from \"./diffMilliseconds\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\nimport { diffRound, type DiffRoundingMethod } from \"./diffRound\"\n\n/**\n * Returns the difference between 2 dates in days.\n * @param dateA - A date to compare with the right date\n * @param [dateB] - A date to compare with the left date or nothing to compare with the current time\n * @param [roundingMethod] - the rounding method to use, default: trunc\n */\nexport function diffDays(\n  dateA: DateInput,\n  dateB?: MaybeDateInput,\n  roundingMethod?: DiffRoundingMethod\n): number\n/**\n * Returns the difference between 2 dates in days.\n * @param [dateA] - A date to compare with the right date or null to compare with the current time\n * @param dateB - A date to compare with the left date\n * @param [roundingMethod] - the rounding method to use, default: trunc\n */\nexport function diffDays(\n  dateA: MaybeDateInput,\n  dateB: DateInput,\n  roundingMethod?: DiffRoundingMethod\n): number\n\nexport function diffDays(\n  dateA: MaybeDateInput,\n  dateB?: MaybeDateInput,\n  roundingMethod?: DiffRoundingMethod\n): number {\n  return diffRound(\n    // @ts-ignore\n    diffMilliseconds(dateA, dateB) / 86_400_000, // hour * 24\n    roundingMethod\n  )\n}\n","import { diffMilliseconds } from \"./diffMilliseconds\"\nimport { DateInput, MaybeDateInput } from \"./types\"\nimport { diffRound, type DiffRoundingMethod } from \"./diffRound\"\n\n/**\n * Returns the difference between 2 dates in days.\n * @param dateA - A date to compare with the right date\n * @param [dateB] - A date to compare with the left date or nothing to compare with the current time\n * @param [roundingMethod] - the rounding method to use, default: trunc\n */\nexport function diffWeeks(\n  dateA: DateInput,\n  dateB: DateInput,\n  roundingMethod?: DiffRoundingMethod\n): number\n\n/**\n * Returns the difference between 2 dates in days.\n * @param [dateA] - A date to compare with the right date or null to compare with the current time\n * @param dateB - A date to compare with the left date\n * @param [roundingMethod] - the rounding method to use, default: trunc\n */\nexport function diffWeeks(\n  dateA: DateInput,\n  dateB: DateInput,\n  roundingMethod?: DiffRoundingMethod\n): number\n\nexport function diffWeeks(\n  dateA: MaybeDateInput,\n  dateB: DateInput,\n  roundingMethod?: DiffRoundingMethod\n): number {\n  return diffRound(\n    diffMilliseconds(dateA, dateB) / 604800000, // day * 7\n    roundingMethod\n  )\n}\n","import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\nimport { monthDays } from \"./monthDays\"\n\n/**\n * Returns the difference between 2 dates in months.\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 diffMonths(dateA: DateInput, dateB?: MaybeDateInput): number\n/**\n * Returns the difference between 2 dates in months.\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 diffMonths(dateA: MaybeDateInput, dateB: DateInput): number\n\nexport function diffMonths(dateA: MaybeDateInput, dateB?: MaybeDateInput): number {\n  const l = date(dateA)\n  const r = date(dateB)\n  // if the dateB one is bigger, we switch them around as it's easier to do\n  if (l < r) {\n    const rs = diffMonths(r, l)\n    return rs == 0 ? 0 : -rs\n  }\n\n  // we first get the amount of calendar months\n  let months = (l.getFullYear() - r.getFullYear()) * 12 + (l.getMonth() - r.getMonth())\n\n  const ld = l.getDate()\n  const rd = r.getDate()\n\n  // if no full month has passed we may subtract a month from the calendar months so we get the amount of full months\n  if (ld < rd) {\n    // in case dateA date is the last day of the month & the dateB date is higher, we don't subtract as a full month did actually pass\n    const lm = monthDays(l)\n    if (!(lm == ld && lm < rd)) {\n      months--\n    }\n  }\n  //ensures we don't give back -0\n  return months == 0 ? 0 : months\n}\n","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":";AAKO,IAAM,eACX;AAMK,SAAS,QAAQA,OAAu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AGA,MAAI,UAAU,EAAE,YAAY,IAAI,EAAE,YAAY,KAAK,MAAM,EAAE,SAAS,IAAI,EAAE,SAAS;AAEnF,QAAM,KAAK,EAAE,QAAQ;AACrB,QAAM,KAAK,EAAE,QAAQ;AAGrB,MAAI,KAAK,IAAI;AAEX,UAAM,KAAK,UAAU,CAAC;AACtB,QAAI,EAAE,MAAM,MAAM,KAAK,KAAK;AAC1B;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,IAAI,IAAI;AAC3B;;;AC1BO,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":["date","date","format","parts","offset","value","hour12","offset","token","parts","format","offset","parts","format","validate","parts","match","date","formats","part","offset","format","format","format","offset","d","parts","i"]}