{"version":3,"sources":["../src/calendarUtils.ts","../src/isoWeek.ts"],"sourcesContent":["/*\n * Copyright 2026 DirazCoder\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Calendar utility helpers. These are pure functions\n// over the TemporalLike shape — no Temporal namespace needed, same\n// approach as isoWeek.ts and the field-reading helpers in format.ts.\n// Letting callers compute dayOfYear/weekOfYear/etc. without going\n// through format() means they can build their own derived values\n// without committing to a string format.\n//\n// Calendar-sensitivity: the helpers in this module assume the\n// iso8601 (Gregorian) calendar — that's what TemporalLike fields\n// carry for the overwhelming majority of callers. Non-Gregorian\n// calendars (hebrew, islamic, etc.) need their own helpers; this\n// module doesn't try to be calendar-polymorphic the way Temporal\n// itself is. Documented limitation, not a design choice — see\n// VERIFICATION.md for the rationale.\n\nimport { isGregorianLeapYear, dayOfYear, isoWeekYearAndWeek, dayOfWeekFromCivil } from './isoWeek.js';\n\n// A subset of TemporalLike that has the date fields these helpers need,\n// plus optional time fields. PlainTime isn't a DateFieldView (no\n// year/month/day), but PlainDateTime / ZonedDateTime / PlainDate all\n// match. Time fields are optional so callers can pass a PlainDate\n// to startOf(value, 'month') without having to populate hour/minute/etc.\n// Exported so the comparison/arithmetic modules can use the same\n// narrowing.\nexport interface DateFieldView {\n  year?: number;\n  month?: number;\n  day?: number;\n  hour?: number;\n  minute?: number;\n  second?: number;\n  millisecond?: number;\n  dayOfWeek?: number;\n  calendarId?: string;\n}\n\nfunction requireFields(view: DateFieldView, fields: Array<keyof DateFieldView>): void {\n  for (const f of fields) {\n    if (typeof view[f] !== 'number') {\n      throw new Error(\n        `temporal-fmt: calendar helper requires \"${String(f)}\", which this value doesn't have. ` +\n        `Pass a Temporal.PlainDate / PlainDateTime / ZonedDateTime.`\n      );\n    }\n  }\n}\n\nexport function daysInMonth(view: DateFieldView): number {\n  requireFields(view, ['year', 'month']);\n  const { year, month } = view;\n  // Standard Gregorian month lengths. February's length depends on\n  // whether `year` is a leap year — the same isGregorianLeapYear check\n  // isoWeek.ts uses for dayOfYear arithmetic.\n  const LENGTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n  if (month === 2 && isGregorianLeapYear(year!)) return 29;\n  return LENGTHS[(month! - 1)!]!;\n}\n\nexport function daysInYear(view: DateFieldView): 365 | 366 {\n  requireFields(view, ['year']);\n  return isGregorianLeapYear(view.year!) ? 366 : 365;\n}\n\nexport function monthsInYear(_view: DateFieldView): 12 {\n  // Gregorian always has 12 months. Other calendars (Hebrew leap years\n  // have 13) need calendar-aware logic this module doesn't carry — see\n  // the file-level comment. The `_view` parameter is kept so the\n  // signature mirrors the other helpers and a future calendar-aware\n  // implementation can use it without changing call sites.\n  return 12;\n}\n\nexport function isLeapYear(view: DateFieldView): boolean {\n  requireFields(view, ['year']);\n  return isGregorianLeapYear(view.year!);\n}\n\n// `isLeapMonth` would require knowing which month of a leap-year-aware\n// calendar is the leap month — Gregorian doesn't have one, so this\n// returns false unconditionally. Kept here so the public surface\n// matches the module's listing; non-Gregorian calendars need\n// a different implementation.\nexport function isLeapMonth(_view: DateFieldView): boolean {\n  return false;\n}\n\nexport function dayOfYearHelper(view: DateFieldView): number {\n  requireFields(view, ['year', 'month', 'day']);\n  return dayOfYear(view.year!, view.month!, view.day!);\n}\n\n// ISO 8601 week and week-year. Delegates to isoWeek.ts's\n// isoWeekYearAndWeek, which does the full Thursday-of-week\n// computation to handle the year-boundary cases (Dec 29-31 belonging\n// to week 1 of next year, Jan 1-3 belonging to week 52/53 of the\n// previous year).\nexport function weekOfYear(view: DateFieldView): number {\n  requireFields(view, ['year', 'month', 'day', 'dayOfWeek']);\n  return isoWeekYearAndWeek(view.year!, view.month!, view.day!, view.dayOfWeek!).week;\n}\n\nexport function weekYear(view: DateFieldView): number {\n  requireFields(view, ['year', 'month', 'day', 'dayOfWeek']);\n  return isoWeekYearAndWeek(view.year!, view.month!, view.day!, view.dayOfWeek!).isoYear;\n}\n\n/**\n * Fiscal-quarter options. `startMonth` is the calendar month (1-12) the\n * fiscal year begins on — e.g. `7` for a fiscal year starting in July.\n * Omitted or `1` gives the calendar-quarter behavior getQuarter() has\n * always had (Jan-Mar = Q1, etc.), so existing callers passing nothing\n * see no change.\n */\nexport interface QuarterOptions {\n  startMonth?: number;\n}\n\nfunction validateStartMonth(startMonth: number): void {\n  if (!Number.isInteger(startMonth) || startMonth < 1 || startMonth > 12) {\n    throw new Error(\n      `temporal-fmt: getQuarter's startMonth must be an integer from 1 to 12 (got ${startMonth}).`\n    );\n  }\n}\n\nexport function getQuarter(view: DateFieldView, options: QuarterOptions = {}): number {\n  requireFields(view, ['month']);\n  const startMonth = options.startMonth ?? 1;\n  validateStartMonth(startMonth);\n  if (startMonth === 1) {\n    // Mirrors the Q token: months 1-3 → Q1, 4-6 → Q2, 7-9 → Q3, 10-12 → Q4.\n    return Math.ceil(view.month! / 3);\n  }\n  // Fiscal case: shift the month so startMonth becomes month 1 of the\n  // fiscal year (mod 12, 1-indexed), then apply the same ceil(/3) rule.\n  // E.g. startMonth=7 (fiscal year starts July): July→1, Aug→2, ...,\n  // Dec→6, Jan→7, ..., June→12. Then Q1 = fiscal months 1-3 (Jul-Sep),\n  // matching the common \"FY starts in July\" convention where Q1 is the\n  // first quarter of the fiscal year, not a quarter numbered by which\n  // calendar quarter it falls in.\n  const shifted = ((view.month! - startMonth + 12) % 12) + 1;\n  return Math.ceil(shifted / 3);\n}\n\n// `getMonth` / `getWeekday` look trivial (just read the field) but\n// they're kept as real functions for API surface consistency with the\n// rest of this module. They also normalize: getWeekday returns 1-7\n// (Mon-Sun, matching Temporal's spec) regardless of what numbering the\n// caller's underlying value uses.\nexport function getMonth(view: DateFieldView): number {\n  requireFields(view, ['month']);\n  return view.month!;\n}\n\nexport function getWeekday(view: DateFieldView): number {\n  requireFields(view, ['dayOfWeek']);\n  return view.dayOfWeek!;\n}\n\n// startOf / endOf return new field bags (not Temporal objects — this\n// module is polyfill-free) with the relevant fields zeroed/extended.\n// Callers can pass the result to a Temporal constructor if they want\n// a typed value.\nexport type StartOfUnit = 'day' | 'month' | 'year' | 'hour' | 'minute' | 'second';\n\n// Returns true if the given unit (when used with startOf/endOf) should\n// also touch the time fields. 'day', 'month', 'year' all imply a\n// resolution coarser than an hour, so startOf zeroes the time fields\n// and endOf maxes them. Sub-hour units (hour/minute/second) only touch\n// the fields finer than themselves.\nfunction touchesTime(unit: StartOfUnit): boolean {\n  return unit === 'day' || unit === 'month' || unit === 'year';\n}\n\n// startOf/endOf reassign year/month/day, which invalidates any\n// dayOfWeek carried over from the input — a plain { ...view } spread\n// leaves the old value sitting there unchanged. Same failure mode\n// businessCalendar.ts's isBusinessDay() works around for add(); we\n// recompute here rather than trust the copied field.\nfunction recomputeDayOfWeek(view: DateFieldView): void {\n  if (typeof view.dayOfWeek !== 'number') return;\n  /* c8 ignore start @preserve -- unreachable: startOf()/endOf() both call\n   * asDateFieldView() before this, which already throws if year/month/day\n   * aren't all numbers — so by the time a value with a numeric dayOfWeek\n   * reaches here, year/month/day are guaranteed present too. */\n  if (typeof view.year !== 'number' || typeof view.month !== 'number' || typeof view.day !== 'number') return;\n  /* c8 ignore stop @preserve */\n  // dayOfWeekFromCivil: O(1) proleptic-Gregorian weekday. The old\n  // Date.UTC(year, month-1, day) form remapped years 0-99 to 1900-1999\n  // (ECMAScript spec), so startOf/endOf of a first-century date carried\n  // a weekday from the wrong century.\n  view.dayOfWeek = dayOfWeekFromCivil(view.year, view.month, view.day);\n}\n\nexport function startOf(value: unknown, unit: StartOfUnit): DateFieldView {\n  const view = asDateFieldView(value);\n  const result: DateFieldView = { ...view };\n  if (unit === 'year') {\n    result.month = 1;\n    result.day = 1;\n  } else if (unit === 'month') {\n    result.day = 1;\n  }\n  recomputeDayOfWeek(result);\n  if (touchesTime(unit)) {\n    result.hour = 0;\n    result.minute = 0;\n    result.second = 0;\n    result.millisecond = 0;\n  } else if (unit === 'hour') {\n    result.minute = 0;\n    result.second = 0;\n    result.millisecond = 0;\n  } else if (unit === 'minute') {\n    result.second = 0;\n    result.millisecond = 0;\n  } else if (unit === 'second') {\n    result.millisecond = 0;\n  }\n  return result;\n}\n\nexport function endOf(value: unknown, unit: StartOfUnit): DateFieldView {\n  const view = asDateFieldView(value);\n  const result: DateFieldView = { ...view };\n  if (unit === 'year') {\n    result.month = 12;\n    result.day = daysInMonth({ year: result.year!, month: 12 });\n  } else if (unit === 'month') {\n    result.day = daysInMonth({ year: result.year!, month: result.month! });\n  }\n  recomputeDayOfWeek(result);\n  if (touchesTime(unit)) {\n    result.hour = 23;\n    result.minute = 59;\n    result.second = 59;\n    result.millisecond = 999;\n  } else if (unit === 'hour') {\n    result.minute = 59;\n    result.second = 59;\n    result.millisecond = 999;\n  } else if (unit === 'minute') {\n    result.second = 59;\n    result.millisecond = 999;\n  } else if (unit === 'second') {\n    result.millisecond = 999;\n  }\n  return result;\n}\n\n// Type-narrowing helpers used by the comparison/arithmetic modules.\n// Lets them accept any of the four date-carrying Temporal types without\n// importing Temporal itself.\nexport function asDateFieldView(value: unknown): DateFieldView {\n  if (typeof value !== 'object' || value === null) {\n    throw new Error(`temporal-fmt: expected a date-carrying Temporal value, got ${String(value)}.`);\n  }\n  // Temporal instances expose year/month/day/etc. as prototype getters,\n  // not own enumerable properties — so `{ ...value }` would lose them.\n  // Read them explicitly. Only the fields actually present on this\n  // value type end up in the returned view.\n  const v = value as Record<string, unknown>;\n  const out: DateFieldView = {};\n  if (typeof v.year === 'number') out.year = v.year;\n  if (typeof v.month === 'number') out.month = v.month;\n  if (typeof v.day === 'number') out.day = v.day;\n  if (typeof v.hour === 'number') out.hour = v.hour;\n  if (typeof v.minute === 'number') out.minute = v.minute;\n  if (typeof v.second === 'number') out.second = v.second;\n  if (typeof v.millisecond === 'number') out.millisecond = v.millisecond;\n  if (typeof v.dayOfWeek === 'number') out.dayOfWeek = v.dayOfWeek;\n  if (typeof v.calendarId === 'string') out.calendarId = v.calendarId;\n  if (out.year === undefined || out.month === undefined || out.day === undefined) {\n    throw new Error(\n      `temporal-fmt: value is missing year/month/day fields — pass a Temporal.PlainDate / PlainDateTime / ZonedDateTime.`\n    );\n  }\n  return out;\n}\n\n// Re-export the TemporalType alias so callers can import everything\n// from one place.\nexport type { TemporalType } from './tokenMetadata.js';\n// Re-export TemporalLike for the same reason.\nexport type { TemporalLike } from './tokens.js';","/*\n * Copyright 2026 DirazCoder\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// ISO week stuff. week runs Mon-Sun, and week 1 is whichever week has\n// the year's first Thursday in it (same as saying \"the week with Jan 4\").\n// took me a minute to wrap my head around this but the upshot is late-Dec\n// dates can land in week 1 of NEXT year, and early-Jan dates can land in\n// week 52/53 of the PREVIOUS year. that adjacent year is what RRRR prints,\n// not the plain calendar year.\n//\n// doing this with plain year/month/day + dayOfWeek math instead of asking\n// Temporal for it, since format() only has whatever fields got handed in\n// and dragging in a whole Temporal implementation just for week numbers\n// felt like overkill (also breaks for people not on setTemporal()).\n\nconst DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nconst CUMULATIVE_DAYS_BY_MONTH = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];\n\nexport function isGregorianLeapYear(year: number): boolean {\n  // divisible by 4, unless it's a century, then it also needs /400.\n  // Temporal's iso8601 calendar never switches to Julian, so this rule\n  // just applies all the way back, even for BCE years.\n  return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n}\n\nfunction daysInYear(year: number): 365 | 366 {\n  return isGregorianLeapYear(year) ? 366 : 365;\n}\n\nexport function dayOfYear(year: number, month: number, day: number): number {\n  let doy = CUMULATIVE_DAYS_BY_MONTH[month - 1]! + day;\n  if (month > 2 && isGregorianLeapYear(year)) doy += 1;\n  return doy;\n}\n\n// Jan 1 2000 was a Saturday (ISO dow 6). picked this as an anchor point\n// since it's easier than reaching for Zeller's congruence every time,\n// and obviously this fact about Jan 1 2000 isn't going to change on us\nconst REFERENCE_YEAR = 2000;\nconst REFERENCE_JAN1_DAY_OF_WEEK = 6;\n\n// Howard Hinnant's days_from_civil: O(1) day count for a proleptic\n// Gregorian y/m/d, correct for negative years and year 0 (the (y2>=0?\n// y2 : y2-399)/400 offset form relies on truncating division, which JS\n// doesn't have — Math.floor on the *un-offset* numerator is the exact\n// JS equivalent, see the matching formulas in arithmetic.ts). Shared by\n// dayOfWeekOfJan1 and any caller needing days between two arbitrary\n// dates without a year-by-year walk (those walks were O(|year − 2000|)\n// per call — a field bag claiming year 2e8 hung formatDistance for\n// ~400ms per call and worse for bigger values).\nexport function daysFromCivil(year: number, month: number, day: number): number {\n  const y2 = month <= 2 ? year - 1 : year;\n  const era = Math.floor(y2 / 400);\n  const yoe = y2 - era * 400; // [0, 399]\n  const m2 = month > 2 ? month - 3 : month + 9; // [0, 11]\n  const doy = Math.floor((153 * m2 + 2) / 5) + day - 1; // [0, 365]\n  const doe = yoe * 365 + Math.floor(yoe / 4) - Math.floor(yoe / 100) + doy; // [0, 146096]\n  return era * 146097 + doe - 719468;\n}\n\n// Day of week (ISO, 1=Mon..7=Sun) for a proleptic Gregorian y/m/d, in\n// O(1). 1970-01-01 was a Thursday (dow 4), so dow = (days + 3) mod 7\n// shifted to 1..7. Replaces the Date.UTC(year, month-1, day) idiom used\n// elsewhere in this library, which silently remaps years 0-99 to\n// 1900-1999 per the ECMAScript spec and produces the wrong weekday for\n// first-century dates.\nexport function dayOfWeekFromCivil(year: number, month: number, day: number): number {\n  const days = daysFromCivil(year, month, day);\n  // days=0 is 1970-01-01 (Thursday, dow 4): (0 + 3) % 7 = 3 → 4 ✓\n  return (((days + 3) % 7) + 7) % 7 + 1;\n}\n\nfunction dayOfWeekOfJan1(year: number): number {\n  // O(1) via daysFromCivil: Jan 1 of `year` is `days` after Jan 1 2000\n  // (a Saturday, dow 6), so dow = (6 - 1 + days) mod 7, bumped to 1-indexed.\n  // The old year-by-year walk from 2000 was O(|year − 2000|) — correct\n  // but linear, and unbounded for hostile field-bag years.\n  const days = daysFromCivil(year, 1, 1) - daysFromCivil(REFERENCE_YEAR, 1, 1);\n  const zeroIndexed = (((REFERENCE_JAN1_DAY_OF_WEEK - 1 + days) % 7) + 7) % 7;\n  return zeroIndexed + 1;\n}\n\nexport interface IsoWeekDate {\n  isoYear: number;\n  week: number; // goes 1 to 53\n}\n\nexport function isoWeekYearAndWeek(year: number, month: number, day: number, dayOfWeek: number): IsoWeekDate {\n  // step 1: figure out the Thursday of this week — whatever calendar year\n  // that Thursday's in IS the ISO week-numbering year. doing this with\n  // day-of-year offsets so we don't need an actual Temporal.PlainDate here\n  const doy = dayOfYear(year, month, day);\n  const thursdayDoyRelative = doy + (4 - dayOfWeek); // can go negative or past daysInYear, that's fine\n\n  let isoYear: number;\n  let thursdayDoy: number;\n  if (thursdayDoyRelative < 1) {\n    isoYear = year - 1;\n    thursdayDoy = thursdayDoyRelative + daysInYear(isoYear);\n  } else if (thursdayDoyRelative > daysInYear(year)) {\n    isoYear = year + 1;\n    thursdayDoy = thursdayDoyRelative - daysInYear(year);\n  } else {\n    isoYear = year;\n    thursdayDoy = thursdayDoyRelative;\n  }\n\n  // step 2: find the first Thursday of isoYear, that one's week 1 by definition.\n  // depends entirely on which weekday Jan 1 lands on\n  const jan1Dow = dayOfWeekOfJan1(isoYear);\n  const firstThursdayDoy = 1 + ((4 - jan1Dow + 7) % 7); // always lands somewhere 1-7\n\n  // step 3: just count how many full weeks between the two Thursdays\n  const week = 1 + Math.floor((thursdayDoy - firstThursdayDoy) / 7);\n  return { isoYear, week };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC6BA,IAAM,2BAA2B,CAAC,GAAG,IAAI,IAAI,IAAI,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,GAAG;AAEhF,SAAS,oBAAoB,MAAuB;AAIzD,SAAQ,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAM,OAAO,QAAQ;AAChE;AAEA,SAAS,WAAW,MAAyB;AAC3C,SAAO,oBAAoB,IAAI,IAAI,MAAM;AAC3C;AAEO,SAAS,UAAU,MAAc,OAAe,KAAqB;AAC1E,MAAI,MAAM,yBAAyB,QAAQ,CAAC,IAAK;AACjD,MAAI,QAAQ,KAAK,oBAAoB,IAAI,EAAG,QAAO;AACnD,SAAO;AACT;AAKA,IAAM,iBAAiB;AACvB,IAAM,6BAA6B;AAW5B,SAAS,cAAc,MAAc,OAAe,KAAqB;AAC9E,QAAM,KAAK,SAAS,IAAI,OAAO,IAAI;AACnC,QAAM,MAAM,KAAK,MAAM,KAAK,GAAG;AAC/B,QAAM,MAAM,KAAK,MAAM;AACvB,QAAM,KAAK,QAAQ,IAAI,QAAQ,IAAI,QAAQ;AAC3C,QAAM,MAAM,KAAK,OAAO,MAAM,KAAK,KAAK,CAAC,IAAI,MAAM;AACnD,QAAM,MAAM,MAAM,MAAM,KAAK,MAAM,MAAM,CAAC,IAAI,KAAK,MAAM,MAAM,GAAG,IAAI;AACtE,SAAO,MAAM,SAAS,MAAM;AAC9B;AAQO,SAAS,mBAAmB,MAAc,OAAe,KAAqB;AACnF,QAAM,OAAO,cAAc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