@gobrand/tiempo 3.1.3 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addBusinessDays.d.ts +14 -4
- package/dist/addBusinessDays.d.ts.map +1 -1
- package/dist/addBusinessDays.js +2 -2
- package/dist/areIntervalsOverlapping.d.ts +60 -0
- package/dist/areIntervalsOverlapping.d.ts.map +1 -0
- package/dist/areIntervalsOverlapping.js +9 -0
- package/dist/areIntervalsOverlapping.js.map +1 -0
- package/dist/chunk-2JXI3CAL.js +22 -0
- package/dist/chunk-2JXI3CAL.js.map +1 -0
- package/dist/{chunk-BYPHFTFD.js → chunk-2LT2XOAL.js} +4 -82
- package/dist/chunk-2LT2XOAL.js.map +1 -0
- package/dist/chunk-3OOGJRXH.js +247 -0
- package/dist/chunk-3OOGJRXH.js.map +1 -0
- package/dist/chunk-42IFQS4W.js +16 -0
- package/dist/chunk-42IFQS4W.js.map +1 -0
- package/dist/{chunk-MXYAZTDE.js → chunk-4FQCY75E.js} +4 -4
- package/dist/chunk-4YCEFGZA.js +61 -0
- package/dist/chunk-4YCEFGZA.js.map +1 -0
- package/dist/chunk-6UBFKQIJ.js +20 -0
- package/dist/chunk-6UBFKQIJ.js.map +1 -0
- package/dist/chunk-7PH5BPMS.js +14 -0
- package/dist/chunk-7PH5BPMS.js.map +1 -0
- package/dist/chunk-C7QA4J6V.js +14 -0
- package/dist/chunk-C7QA4J6V.js.map +1 -0
- package/dist/chunk-DVZDJ5LM.js +33 -0
- package/dist/chunk-DVZDJ5LM.js.map +1 -0
- package/dist/{chunk-AOODDNHA.js → chunk-DYIISNVW.js} +14 -12
- package/dist/chunk-DYIISNVW.js.map +1 -0
- package/dist/{chunk-6QZUAJVF.js → chunk-GOJ45AG7.js} +2 -2
- package/dist/chunk-H43LMOCK.js +26 -0
- package/dist/chunk-H43LMOCK.js.map +1 -0
- package/dist/chunk-HH2HTC44.js +87 -0
- package/dist/chunk-HH2HTC44.js.map +1 -0
- package/dist/chunk-IDB3R3G5.js +21 -0
- package/dist/chunk-IDB3R3G5.js.map +1 -0
- package/dist/chunk-IIEHQPKE.js +36 -0
- package/dist/chunk-IIEHQPKE.js.map +1 -0
- package/dist/{chunk-OVBZ2NBB.js → chunk-K7SY2MAX.js} +10 -4
- package/dist/chunk-K7SY2MAX.js.map +1 -0
- package/dist/chunk-KZYWHHAQ.js +19 -0
- package/dist/chunk-KZYWHHAQ.js.map +1 -0
- package/dist/chunk-M2XB72L5.js +17 -0
- package/dist/chunk-M2XB72L5.js.map +1 -0
- package/dist/chunk-OMUK2MOH.js +19 -0
- package/dist/chunk-OMUK2MOH.js.map +1 -0
- package/dist/chunk-PLPGYCQQ.js +28 -0
- package/dist/chunk-PLPGYCQQ.js.map +1 -0
- package/dist/chunk-R6D3Y5NV.js +17 -0
- package/dist/chunk-R6D3Y5NV.js.map +1 -0
- package/dist/chunk-U6VFT2A5.js +14 -0
- package/dist/chunk-U6VFT2A5.js.map +1 -0
- package/dist/chunk-XMEPH226.js +21 -0
- package/dist/chunk-XMEPH226.js.map +1 -0
- package/dist/{chunk-NGS5UKDW.js → chunk-ZNRTNR2Q.js} +4 -4
- package/dist/differenceInBusinessDays.d.ts +7 -5
- package/dist/differenceInBusinessDays.d.ts.map +1 -1
- package/dist/differenceInBusinessDays.js +2 -2
- package/dist/differenceInCalendarDays.d.ts +35 -0
- package/dist/differenceInCalendarDays.d.ts.map +1 -0
- package/dist/differenceInCalendarDays.js +10 -0
- package/dist/differenceInCalendarDays.js.map +1 -0
- package/dist/differenceInCalendarMonths.d.ts +27 -0
- package/dist/differenceInCalendarMonths.d.ts.map +1 -0
- package/dist/differenceInCalendarMonths.js +10 -0
- package/dist/differenceInCalendarMonths.js.map +1 -0
- package/dist/differenceInCalendarQuarters.d.ts +26 -0
- package/dist/differenceInCalendarQuarters.d.ts.map +1 -0
- package/dist/differenceInCalendarQuarters.js +11 -0
- package/dist/differenceInCalendarQuarters.js.map +1 -0
- package/dist/differenceInCalendarWeeks.d.ts +29 -0
- package/dist/differenceInCalendarWeeks.d.ts.map +1 -0
- package/dist/differenceInCalendarWeeks.js +11 -0
- package/dist/differenceInCalendarWeeks.js.map +1 -0
- package/dist/differenceInCalendarYears.d.ts +27 -0
- package/dist/differenceInCalendarYears.d.ts.map +1 -0
- package/dist/differenceInCalendarYears.js +10 -0
- package/dist/differenceInCalendarYears.js.map +1 -0
- package/dist/eachWeekOfInterval.d.ts +7 -5
- package/dist/eachWeekOfInterval.d.ts.map +1 -1
- package/dist/eachWeekOfInterval.js +2 -1
- package/dist/endOfQuarter.js +2 -2
- package/dist/endOfWeek.d.ts +17 -7
- package/dist/endOfWeek.d.ts.map +1 -1
- package/dist/endOfWeek.js +2 -1
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +2 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +117 -78
- package/dist/isSameWeek.d.ts +16 -7
- package/dist/isSameWeek.d.ts.map +1 -1
- package/dist/isSameWeek.js +2 -1
- package/dist/isWeekend.js +2 -2
- package/dist/isWithinInterval.d.ts +41 -6
- package/dist/isWithinInterval.d.ts.map +1 -1
- package/dist/isWithinInterval.js +3 -2
- package/dist/nextDay.d.ts +33 -0
- package/dist/nextDay.d.ts.map +1 -0
- package/dist/nextDay.js +10 -0
- package/dist/nextDay.js.map +1 -0
- package/dist/parse.d.ts +57 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +9 -0
- package/dist/parse.js.map +1 -0
- package/dist/previousDay.d.ts +26 -0
- package/dist/previousDay.d.ts.map +1 -0
- package/dist/previousDay.js +10 -0
- package/dist/previousDay.js.map +1 -0
- package/dist/shared/businessDays.d.ts +15 -0
- package/dist/shared/businessDays.d.ts.map +1 -1
- package/dist/shared/businessDays.js +7 -3
- package/dist/shared/calendarDates.d.ts +9 -0
- package/dist/shared/calendarDates.d.ts.map +1 -0
- package/dist/shared/calendarDates.js +9 -0
- package/dist/shared/calendarDates.js.map +1 -0
- package/dist/shared/formatTokens.d.ts +8 -0
- package/dist/shared/formatTokens.d.ts.map +1 -0
- package/dist/shared/formatTokens.js +7 -0
- package/dist/shared/formatTokens.js.map +1 -0
- package/dist/shared/week.d.ts +26 -0
- package/dist/shared/week.d.ts.map +1 -0
- package/dist/shared/week.js +9 -0
- package/dist/shared/week.js.map +1 -0
- package/dist/startOfQuarter.js +2 -2
- package/dist/startOfWeek.d.ts +17 -7
- package/dist/startOfWeek.d.ts.map +1 -1
- package/dist/startOfWeek.js +2 -1
- package/dist/subBusinessDays.d.ts +6 -4
- package/dist/subBusinessDays.d.ts.map +1 -1
- package/dist/subBusinessDays.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-2TISXHHK.js +0 -29
- package/dist/chunk-2TISXHHK.js.map +0 -1
- package/dist/chunk-4PS6BEAC.js +0 -16
- package/dist/chunk-4PS6BEAC.js.map +0 -1
- package/dist/chunk-57MHNRCU.js +0 -22
- package/dist/chunk-57MHNRCU.js.map +0 -1
- package/dist/chunk-AOODDNHA.js.map +0 -1
- package/dist/chunk-BYPHFTFD.js.map +0 -1
- package/dist/chunk-D3N7BT44.js +0 -22
- package/dist/chunk-D3N7BT44.js.map +0 -1
- package/dist/chunk-GCVX5QIX.js +0 -15
- package/dist/chunk-GCVX5QIX.js.map +0 -1
- package/dist/chunk-K7CLBBBM.js +0 -36
- package/dist/chunk-K7CLBBBM.js.map +0 -1
- package/dist/chunk-MLHFNZEA.js +0 -26
- package/dist/chunk-MLHFNZEA.js.map +0 -1
- package/dist/chunk-OVBZ2NBB.js.map +0 -1
- /package/dist/{chunk-MXYAZTDE.js.map → chunk-4FQCY75E.js.map} +0 -0
- /package/dist/{chunk-6QZUAJVF.js.map → chunk-GOJ45AG7.js.map} +0 -0
- /package/dist/{chunk-NGS5UKDW.js.map → chunk-ZNRTNR2Q.js.map} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
plainDateToZonedDateTime
|
|
3
|
+
} from "./chunk-2AID4P2C.js";
|
|
4
|
+
import {
|
|
5
|
+
daysIntoWeek
|
|
6
|
+
} from "./chunk-M2XB72L5.js";
|
|
7
|
+
import {
|
|
8
|
+
normalizeTemporalInput
|
|
9
|
+
} from "./chunk-Q6QLOUXJ.js";
|
|
10
|
+
import {
|
|
11
|
+
isPlainDate
|
|
12
|
+
} from "./chunk-BSVOJYJ7.js";
|
|
13
|
+
|
|
14
|
+
// src/startOfWeek.ts
|
|
15
|
+
function startOfWeek(input, timezoneOrOptions, options) {
|
|
16
|
+
const timezone = typeof timezoneOrOptions === "string" ? timezoneOrOptions : void 0;
|
|
17
|
+
const weekOptions = typeof timezoneOrOptions === "string" ? options : timezoneOrOptions;
|
|
18
|
+
if (isPlainDate(input) && timezone === void 0) {
|
|
19
|
+
return input.subtract({ days: daysIntoWeek(input.dayOfWeek, weekOptions) });
|
|
20
|
+
}
|
|
21
|
+
const zonedDateTime = isPlainDate(input) ? plainDateToZonedDateTime(input, timezone) : normalizeTemporalInput(input);
|
|
22
|
+
return zonedDateTime.subtract({ days: daysIntoWeek(zonedDateTime.dayOfWeek, weekOptions) }).startOfDay();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
startOfWeek
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=chunk-PLPGYCQQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/startOfWeek.ts"],"sourcesContent":["import { type Temporal, isPlainDate } from './shared/temporal';\nimport type { Timezone } from './types';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { plainDateToZonedDateTime } from './shared/plainDateToZonedDateTime';\nimport { daysIntoWeek, type WeekOptions } from './shared/week';\n\n/**\n * Returns the first boundary of the week.\n * Weeks start on Monday (ISO 8601) unless `weekStartsOn` says otherwise.\n * PlainDate inputs stay in calendar space unless a timezone is provided.\n *\n * @param input - A Temporal.Instant (UTC), Temporal.ZonedDateTime, or Temporal.PlainDate\n * @param options - `weekStartsOn`: 1 = Monday (default) … 7 = Sunday\n * @returns The first day of the week at 00:00, or that date for PlainDate input\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-01-20T12:00:00Z'); // Monday\n * const start = startOfWeek(instant);\n * // 2025-01-20T00:00:00+00:00[UTC] (same day, it's already Monday)\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-01-22T15:30:00-05:00[America/New_York]'); // Wednesday\n * const start = startOfWeek(zoned);\n * // 2025-01-20T00:00:00-05:00[America/New_York] (previous Monday)\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate (stays a date)\n * const date = Temporal.PlainDate.from('2025-01-22'); // Wednesday\n * const start = startOfWeek(date);\n * // 2025-01-20 (previous Monday)\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate with a timezone (returns a ZonedDateTime)\n * const date = Temporal.PlainDate.from('2025-01-22'); // Wednesday\n * const start = startOfWeek(date, 'America/New_York');\n * // 2025-01-20T00:00:00-05:00[America/New_York] (previous Monday)\n * ```\n *\n * @example\n * ```ts\n * // Weeks that start on Sunday\n * const date = Temporal.PlainDate.from('2025-01-22'); // Wednesday\n * const start = startOfWeek(date, { weekStartsOn: 7 });\n * // 2025-01-19 (previous Sunday)\n * ```\n */\nexport function startOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime,\n options?: WeekOptions\n): Temporal.ZonedDateTime;\nexport function startOfWeek(input: Temporal.PlainDate, options?: WeekOptions): Temporal.PlainDate;\nexport function startOfWeek(\n input: Temporal.PlainDate,\n timezone: Timezone,\n options?: WeekOptions\n): Temporal.ZonedDateTime;\nexport function startOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezoneOrOptions?: Timezone | WeekOptions,\n options?: WeekOptions\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n const timezone = typeof timezoneOrOptions === 'string' ? timezoneOrOptions : undefined;\n const weekOptions = typeof timezoneOrOptions === 'string' ? options : timezoneOrOptions;\n\n if (isPlainDate(input) && timezone === undefined) {\n return input.subtract({ days: daysIntoWeek(input.dayOfWeek, weekOptions) });\n }\n\n const zonedDateTime = isPlainDate(input)\n ? plainDateToZonedDateTime(input, timezone!)\n : normalizeTemporalInput(input);\n\n return zonedDateTime\n .subtract({ days: daysIntoWeek(zonedDateTime.dayOfWeek, weekOptions) })\n .startOfDay();\n}\n"],"mappings":";;;;;;;;;;;;;;AAiEO,SAAS,YACd,OACA,mBACA,SAC6C;AAC7C,QAAM,WAAW,OAAO,sBAAsB,WAAW,oBAAoB;AAC7E,QAAM,cAAc,OAAO,sBAAsB,WAAW,UAAU;AAEtE,MAAI,YAAY,KAAK,KAAK,aAAa,QAAW;AAChD,WAAO,MAAM,SAAS,EAAE,MAAM,aAAa,MAAM,WAAW,WAAW,EAAE,CAAC;AAAA,EAC5E;AAEA,QAAM,gBAAgB,YAAY,KAAK,IACnC,yBAAyB,OAAO,QAAS,IACzC,uBAAuB,KAAK;AAEhC,SAAO,cACJ,SAAS,EAAE,MAAM,aAAa,cAAc,WAAW,WAAW,EAAE,CAAC,EACrE,WAAW;AAChB;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compare
|
|
3
|
+
} from "./chunk-OMYVTYHI.js";
|
|
4
|
+
|
|
5
|
+
// src/areIntervalsOverlapping.ts
|
|
6
|
+
function areIntervalsOverlapping(left, right, options) {
|
|
7
|
+
if (compare(left.start, left.end) > 0 || compare(right.start, right.end) > 0) {
|
|
8
|
+
throw new RangeError("Interval start must not be after its end");
|
|
9
|
+
}
|
|
10
|
+
const limit = options?.inclusive ? 0 : -1;
|
|
11
|
+
return compare(left.start, right.end) <= limit && compare(right.start, left.end) <= limit;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
areIntervalsOverlapping
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-R6D3Y5NV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/areIntervalsOverlapping.ts"],"sourcesContent":["import type { Temporal } from './shared/temporal';\nimport { compare, type Timeline } from './shared/compare';\n\n/**\n * Returns true if two intervals share any time.\n *\n * By default an interval that ends exactly where the other starts does not\n * overlap it, so back-to-back bookings are allowed. Pass `{ inclusive: true }`\n * to count a shared endpoint, as for inclusive date ranges.\n *\n * Instants and ZonedDateTimes compare by the moment they represent. PlainDate\n * intervals compare by date. Mixing PlainDate and timeline endpoints throws a\n * TypeError; an interval whose start is after its end throws a RangeError.\n *\n * @param left - The first interval\n * @param right - The second interval\n * @param options - `inclusive`: count intervals that only touch as overlapping\n * @returns true if the intervals overlap\n *\n * @example\n * ```ts\n * const meeting = {\n * start: Temporal.ZonedDateTime.from('2025-01-20T09:00:00+01:00[Europe/Madrid]'),\n * end: Temporal.ZonedDateTime.from('2025-01-20T10:00:00+01:00[Europe/Madrid]')\n * };\n * const call = {\n * start: Temporal.Instant.from('2025-01-20T08:30:00Z'), // 09:30 in Madrid\n * end: Temporal.Instant.from('2025-01-20T09:30:00Z')\n * };\n *\n * areIntervalsOverlapping(meeting, call); // true\n * ```\n *\n * @example\n * ```ts\n * const firstStay = { start: Temporal.PlainDate.from('2025-07-01'), end: Temporal.PlainDate.from('2025-07-04') };\n * const nextStay = { start: Temporal.PlainDate.from('2025-07-04'), end: Temporal.PlainDate.from('2025-07-08') };\n *\n * areIntervalsOverlapping(firstStay, nextStay); // false\n * areIntervalsOverlapping(firstStay, nextStay, { inclusive: true }); // true\n * ```\n */\nexport function areIntervalsOverlapping(\n left: { start: Temporal.PlainDate; end: Temporal.PlainDate },\n right: { start: Temporal.PlainDate; end: Temporal.PlainDate },\n options?: { inclusive?: boolean }\n): boolean;\nexport function areIntervalsOverlapping(\n left: { start: Timeline; end: Timeline },\n right: { start: Timeline; end: Timeline },\n options?: { inclusive?: boolean }\n): boolean;\nexport function areIntervalsOverlapping(\n left: { start: Timeline | Temporal.PlainDate; end: Timeline | Temporal.PlainDate },\n right: { start: Timeline | Temporal.PlainDate; end: Timeline | Temporal.PlainDate },\n options?: { inclusive?: boolean }\n): boolean {\n if (compare(left.start, left.end) > 0 || compare(right.start, right.end) > 0) {\n throw new RangeError('Interval start must not be after its end');\n }\n const limit = options?.inclusive ? 0 : -1;\n return compare(left.start, right.end) <= limit && compare(right.start, left.end) <= limit;\n}\n"],"mappings":";;;;;AAoDO,SAAS,wBACd,MACA,OACA,SACS;AACT,MAAI,QAAQ,KAAK,OAAO,KAAK,GAAG,IAAI,KAAK,QAAQ,MAAM,OAAO,MAAM,GAAG,IAAI,GAAG;AAC5E,UAAM,IAAI,WAAW,0CAA0C;AAAA,EACjE;AACA,QAAM,QAAQ,SAAS,YAAY,IAAI;AACvC,SAAO,QAAQ,KAAK,OAAO,MAAM,GAAG,KAAK,SAAS,QAAQ,MAAM,OAAO,KAAK,GAAG,KAAK;AACtF;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
calendarDates
|
|
3
|
+
} from "./chunk-H43LMOCK.js";
|
|
4
|
+
|
|
5
|
+
// src/differenceInCalendarMonths.ts
|
|
6
|
+
function differenceInCalendarMonths(laterDate, earlierDate) {
|
|
7
|
+
const [later, earlier] = calendarDates(laterDate, earlierDate);
|
|
8
|
+
return earlier.with({ day: 1 }).until(later.with({ day: 1 }), { largestUnit: "months" }).months;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
differenceInCalendarMonths
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=chunk-U6VFT2A5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/differenceInCalendarMonths.ts"],"sourcesContent":["import type { Temporal } from './shared/temporal';\nimport { calendarDates } from './shared/calendarDates';\n\n/**\n * Returns the number of calendar months between two dates, ignoring the day of\n * the month. Unlike differenceInMonths, which counts complete months, January 31\n * to February 1 is one calendar month.\n *\n * PlainDate inputs are compared as given. Instant inputs use their UTC date and\n * ZonedDateTime inputs use the date in their own timezone; convert both to one\n * timezone first to count from a single point of view. Mixing a PlainDate with\n * an Instant or ZonedDateTime throws a TypeError.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @returns Calendar months from earlierDate to laterDate; negative if laterDate is earlier\n *\n * @example\n * ```ts\n * const jan31 = Temporal.PlainDate.from('2025-01-31');\n * const feb1 = Temporal.PlainDate.from('2025-02-01');\n *\n * differenceInCalendarMonths(feb1, jan31); // 1\n * differenceInMonths(feb1, jan31); // 0\n * ```\n */\nexport function differenceInCalendarMonths(\n laterDate: Temporal.PlainDate,\n earlierDate: Temporal.PlainDate\n): number;\nexport function differenceInCalendarMonths(\n laterDate: Temporal.Instant | Temporal.ZonedDateTime,\n earlierDate: Temporal.Instant | Temporal.ZonedDateTime\n): number;\nexport function differenceInCalendarMonths(\n laterDate: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n earlierDate: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate\n): number {\n const [later, earlier] = calendarDates(laterDate, earlierDate);\n return earlier.with({ day: 1 }).until(later.with({ day: 1 }), { largestUnit: 'months' }).months;\n}\n"],"mappings":";;;;;AAkCO,SAAS,2BACd,WACA,aACQ;AACR,QAAM,CAAC,OAAO,OAAO,IAAI,cAAc,WAAW,WAAW;AAC7D,SAAO,QAAQ,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,MAAM,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,aAAa,SAAS,CAAC,EAAE;AAC3F;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertDayOfWeek
|
|
3
|
+
} from "./chunk-M2XB72L5.js";
|
|
4
|
+
import {
|
|
5
|
+
normalizeTemporalInput
|
|
6
|
+
} from "./chunk-Q6QLOUXJ.js";
|
|
7
|
+
import {
|
|
8
|
+
isPlainDate
|
|
9
|
+
} from "./chunk-BSVOJYJ7.js";
|
|
10
|
+
|
|
11
|
+
// src/previousDay.ts
|
|
12
|
+
function previousDay(input, day) {
|
|
13
|
+
assertDayOfWeek(day, "day");
|
|
14
|
+
const value = isPlainDate(input) ? input : normalizeTemporalInput(input);
|
|
15
|
+
return value.subtract({ days: (value.dayOfWeek - day + 6) % 7 + 1 });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
previousDay
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=chunk-XMEPH226.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/previousDay.ts"],"sourcesContent":["import { type Temporal, isPlainDate } from './shared/temporal';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { assertDayOfWeek, type DayOfWeek } from './shared/week';\n\n/**\n * Returns the previous date that falls on the given day of the week, always\n * before the input: previous Monday from a Monday is a week earlier.\n *\n * Days are numbered as Temporal numbers them: 1 = Monday … 7 = Sunday.\n * PlainDate inputs stay dates. Instant inputs are read in UTC and ZonedDateTime\n * inputs keep their timezone; both keep their wall-clock time.\n *\n * @param input - A Temporal.Instant (UTC), Temporal.ZonedDateTime, or Temporal.PlainDate\n * @param day - The day of the week to find, 1 = Monday … 7 = Sunday\n * @returns The previous date on that day of the week\n *\n * @example\n * ```ts\n * const wednesday = Temporal.PlainDate.from('2025-01-22');\n *\n * previousDay(wednesday, 1).toString(); // \"2025-01-20\"\n * previousDay(wednesday, 3).toString(); // \"2025-01-15\"\n * previousDay(wednesday, 7).toString(); // \"2025-01-19\"\n * ```\n */\nexport function previousDay(input: Temporal.PlainDate, day: DayOfWeek): Temporal.PlainDate;\nexport function previousDay(\n input: Temporal.Instant | Temporal.ZonedDateTime,\n day: DayOfWeek\n): Temporal.ZonedDateTime;\nexport function previousDay(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n day: DayOfWeek\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n assertDayOfWeek(day, 'day');\n const value = isPlainDate(input) ? input : normalizeTemporalInput(input);\n return value.subtract({ days: ((value.dayOfWeek - day + 6) % 7) + 1 });\n}\n"],"mappings":";;;;;;;;;;;AA8BO,SAAS,YACd,OACA,KAC6C;AAC7C,kBAAgB,KAAK,KAAK;AAC1B,QAAM,QAAQ,YAAY,KAAK,IAAI,QAAQ,uBAAuB,KAAK;AACvE,SAAO,MAAM,SAAS,EAAE,OAAQ,MAAM,YAAY,MAAM,KAAK,IAAK,EAAE,CAAC;AACvE;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
quarterStartMonth
|
|
3
|
-
} from "./chunk-XS2HUADA.js";
|
|
4
1
|
import {
|
|
5
2
|
normalizeWithPlainDate
|
|
6
3
|
} from "./chunk-TCB3IDJM.js";
|
|
4
|
+
import {
|
|
5
|
+
quarterStartMonth
|
|
6
|
+
} from "./chunk-XS2HUADA.js";
|
|
7
7
|
import {
|
|
8
8
|
isPlainDate
|
|
9
9
|
} from "./chunk-BSVOJYJ7.js";
|
|
@@ -24,4 +24,4 @@ function startOfQuarter(input, timezone) {
|
|
|
24
24
|
export {
|
|
25
25
|
startOfQuarter
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-ZNRTNR2Q.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Temporal } from './shared/temporal.js';
|
|
2
2
|
/**
|
|
3
3
|
* Returns the number of business days (Monday–Friday) from earlierDate up to
|
|
4
|
-
* laterDate: the earlier date counts, the later date does not.
|
|
5
|
-
* not
|
|
4
|
+
* laterDate: the earlier date counts, the later date does not. Dates in
|
|
5
|
+
* `holidays` are not counted. Swapping the arguments negates the result.
|
|
6
6
|
*
|
|
7
7
|
* Only calendar dates matter; times of day are ignored. Instant inputs use
|
|
8
8
|
* their UTC date and ZonedDateTime inputs use their own timezone's date.
|
|
@@ -10,6 +10,7 @@ import { type Temporal } from './shared/temporal.js';
|
|
|
10
10
|
*
|
|
11
11
|
* @param laterDate - The later date
|
|
12
12
|
* @param earlierDate - The earlier date
|
|
13
|
+
* @param holidays - Dates that are not business days, matched by date
|
|
13
14
|
* @returns Business days between the dates (negative if laterDate is earlier)
|
|
14
15
|
*
|
|
15
16
|
* @example
|
|
@@ -19,8 +20,9 @@ import { type Temporal } from './shared/temporal.js';
|
|
|
19
20
|
*
|
|
20
21
|
* differenceInBusinessDays(nextFriday, friday); // 5
|
|
21
22
|
* differenceInBusinessDays(friday, nextFriday); // -5
|
|
23
|
+
* differenceInBusinessDays(nextFriday, friday, [Temporal.PlainDate.from('2025-01-27')]); // 4
|
|
22
24
|
* ```
|
|
23
25
|
*/
|
|
24
|
-
export declare function differenceInBusinessDays(laterDate: Temporal.PlainDate, earlierDate: Temporal.PlainDate): number;
|
|
25
|
-
export declare function differenceInBusinessDays(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
26
|
+
export declare function differenceInBusinessDays(laterDate: Temporal.PlainDate, earlierDate: Temporal.PlainDate, holidays?: readonly Temporal.PlainDate[]): number;
|
|
27
|
+
export declare function differenceInBusinessDays(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime, holidays?: readonly Temporal.PlainDate[]): number;
|
|
26
28
|
//# sourceMappingURL=differenceInBusinessDays.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"differenceInBusinessDays.d.ts","sourceRoot":"","sources":["../src/differenceInBusinessDays.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"differenceInBusinessDays.d.ts","sourceRoot":"","sources":["../src/differenceInBusinessDays.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,MAAM,mBAAmB,CAAC;AAG1D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAC7B,WAAW,EAAE,QAAQ,CAAC,SAAS,EAC/B,QAAQ,CAAC,EAAE,SAAS,QAAQ,CAAC,SAAS,EAAE,GACvC,MAAM,CAAC;AACV,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACtD,QAAQ,CAAC,EAAE,SAAS,QAAQ,CAAC,SAAS,EAAE,GACvC,MAAM,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Temporal } from './shared/temporal.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of calendar days between two dates, ignoring the time of day.
|
|
4
|
+
* Unlike differenceInDays, which counts complete 24-hour days, 23:00 to 01:00
|
|
5
|
+
* the next morning is one calendar day.
|
|
6
|
+
*
|
|
7
|
+
* PlainDate inputs are compared as given. Instant inputs use their UTC date and
|
|
8
|
+
* ZonedDateTime inputs use the date in their own timezone; convert both to one
|
|
9
|
+
* timezone first to count from a single point of view. Mixing a PlainDate with
|
|
10
|
+
* an Instant or ZonedDateTime throws a TypeError.
|
|
11
|
+
*
|
|
12
|
+
* @param laterDate - The later date
|
|
13
|
+
* @param earlierDate - The earlier date
|
|
14
|
+
* @returns Calendar days from earlierDate to laterDate; negative if laterDate is earlier
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const lateTonight = Temporal.ZonedDateTime.from('2025-01-20T23:00:00+01:00[Europe/Madrid]');
|
|
19
|
+
* const earlyTomorrow = Temporal.ZonedDateTime.from('2025-01-21T01:00:00+01:00[Europe/Madrid]');
|
|
20
|
+
*
|
|
21
|
+
* differenceInCalendarDays(earlyTomorrow, lateTonight); // 1
|
|
22
|
+
* differenceInDays(earlyTomorrow, lateTonight); // 0
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const due = Temporal.PlainDate.from('2025-03-01');
|
|
28
|
+
* const today = Temporal.PlainDate.from('2025-02-26');
|
|
29
|
+
*
|
|
30
|
+
* differenceInCalendarDays(due, today); // 3
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function differenceInCalendarDays(laterDate: Temporal.PlainDate, earlierDate: Temporal.PlainDate): number;
|
|
34
|
+
export declare function differenceInCalendarDays(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
35
|
+
//# sourceMappingURL=differenceInCalendarDays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInCalendarDays.d.ts","sourceRoot":"","sources":["../src/differenceInCalendarDays.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAC7B,WAAW,EAAE,QAAQ,CAAC,SAAS,GAC9B,MAAM,CAAC;AACV,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
differenceInCalendarDays
|
|
3
|
+
} from "./chunk-7PH5BPMS.js";
|
|
4
|
+
import "./chunk-H43LMOCK.js";
|
|
5
|
+
import "./chunk-Q6QLOUXJ.js";
|
|
6
|
+
import "./chunk-BSVOJYJ7.js";
|
|
7
|
+
export {
|
|
8
|
+
differenceInCalendarDays
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=differenceInCalendarDays.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Temporal } from './shared/temporal.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of calendar months between two dates, ignoring the day of
|
|
4
|
+
* the month. Unlike differenceInMonths, which counts complete months, January 31
|
|
5
|
+
* to February 1 is one calendar month.
|
|
6
|
+
*
|
|
7
|
+
* PlainDate inputs are compared as given. Instant inputs use their UTC date and
|
|
8
|
+
* ZonedDateTime inputs use the date in their own timezone; convert both to one
|
|
9
|
+
* timezone first to count from a single point of view. Mixing a PlainDate with
|
|
10
|
+
* an Instant or ZonedDateTime throws a TypeError.
|
|
11
|
+
*
|
|
12
|
+
* @param laterDate - The later date
|
|
13
|
+
* @param earlierDate - The earlier date
|
|
14
|
+
* @returns Calendar months from earlierDate to laterDate; negative if laterDate is earlier
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const jan31 = Temporal.PlainDate.from('2025-01-31');
|
|
19
|
+
* const feb1 = Temporal.PlainDate.from('2025-02-01');
|
|
20
|
+
*
|
|
21
|
+
* differenceInCalendarMonths(feb1, jan31); // 1
|
|
22
|
+
* differenceInMonths(feb1, jan31); // 0
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function differenceInCalendarMonths(laterDate: Temporal.PlainDate, earlierDate: Temporal.PlainDate): number;
|
|
26
|
+
export declare function differenceInCalendarMonths(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
27
|
+
//# sourceMappingURL=differenceInCalendarMonths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInCalendarMonths.d.ts","sourceRoot":"","sources":["../src/differenceInCalendarMonths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAC7B,WAAW,EAAE,QAAQ,CAAC,SAAS,GAC9B,MAAM,CAAC;AACV,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
differenceInCalendarMonths
|
|
3
|
+
} from "./chunk-U6VFT2A5.js";
|
|
4
|
+
import "./chunk-H43LMOCK.js";
|
|
5
|
+
import "./chunk-Q6QLOUXJ.js";
|
|
6
|
+
import "./chunk-BSVOJYJ7.js";
|
|
7
|
+
export {
|
|
8
|
+
differenceInCalendarMonths
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=differenceInCalendarMonths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Temporal } from './shared/temporal.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of calendar quarters between two dates, ignoring the
|
|
4
|
+
* position within the quarter. Quarters follow ISO months: Q1 is January–March.
|
|
5
|
+
*
|
|
6
|
+
* PlainDate inputs are compared as given. Instant inputs use their UTC date and
|
|
7
|
+
* ZonedDateTime inputs use the date in their own timezone; convert both to one
|
|
8
|
+
* timezone first to count from a single point of view. Mixing a PlainDate with
|
|
9
|
+
* an Instant or ZonedDateTime throws a TypeError.
|
|
10
|
+
*
|
|
11
|
+
* @param laterDate - The later date
|
|
12
|
+
* @param earlierDate - The earlier date
|
|
13
|
+
* @returns Calendar quarters from earlierDate to laterDate; negative if laterDate is earlier
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const endOfQ1 = Temporal.PlainDate.from('2025-03-31');
|
|
18
|
+
* const startOfQ2 = Temporal.PlainDate.from('2025-04-01');
|
|
19
|
+
*
|
|
20
|
+
* differenceInCalendarQuarters(startOfQ2, endOfQ1); // 1
|
|
21
|
+
* differenceInQuarters(startOfQ2, endOfQ1); // 0
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function differenceInCalendarQuarters(laterDate: Temporal.PlainDate, earlierDate: Temporal.PlainDate): number;
|
|
25
|
+
export declare function differenceInCalendarQuarters(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
26
|
+
//# sourceMappingURL=differenceInCalendarQuarters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInCalendarQuarters.d.ts","sourceRoot":"","sources":["../src/differenceInCalendarQuarters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIlD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,QAAQ,CAAC,SAAS,EAC7B,WAAW,EAAE,QAAQ,CAAC,SAAS,GAC9B,MAAM,CAAC;AACV,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
differenceInCalendarQuarters
|
|
3
|
+
} from "./chunk-OMUK2MOH.js";
|
|
4
|
+
import "./chunk-XS2HUADA.js";
|
|
5
|
+
import "./chunk-H43LMOCK.js";
|
|
6
|
+
import "./chunk-Q6QLOUXJ.js";
|
|
7
|
+
import "./chunk-BSVOJYJ7.js";
|
|
8
|
+
export {
|
|
9
|
+
differenceInCalendarQuarters
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=differenceInCalendarQuarters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Temporal } from './shared/temporal.js';
|
|
2
|
+
import { type WeekOptions } from './shared/week.js';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the number of week boundaries crossed between two dates, ignoring the
|
|
5
|
+
* day within the week. Weeks start on Monday (ISO 8601) unless `weekStartsOn`
|
|
6
|
+
* says otherwise.
|
|
7
|
+
*
|
|
8
|
+
* PlainDate inputs are compared as given. Instant inputs use their UTC date and
|
|
9
|
+
* ZonedDateTime inputs use the date in their own timezone; convert both to one
|
|
10
|
+
* timezone first to count from a single point of view. Mixing a PlainDate with
|
|
11
|
+
* an Instant or ZonedDateTime throws a TypeError.
|
|
12
|
+
*
|
|
13
|
+
* @param laterDate - The later date
|
|
14
|
+
* @param earlierDate - The earlier date
|
|
15
|
+
* @param options - `weekStartsOn`: 1 = Monday (default) … 7 = Sunday
|
|
16
|
+
* @returns Calendar weeks from earlierDate to laterDate; negative if laterDate is earlier
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const sunday = Temporal.PlainDate.from('2025-01-26');
|
|
21
|
+
* const monday = Temporal.PlainDate.from('2025-01-27');
|
|
22
|
+
*
|
|
23
|
+
* differenceInCalendarWeeks(monday, sunday); // 1
|
|
24
|
+
* differenceInCalendarWeeks(monday, sunday, { weekStartsOn: 7 }); // 0
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function differenceInCalendarWeeks(laterDate: Temporal.PlainDate, earlierDate: Temporal.PlainDate, options?: WeekOptions): number;
|
|
28
|
+
export declare function differenceInCalendarWeeks(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime, options?: WeekOptions): number;
|
|
29
|
+
//# sourceMappingURL=differenceInCalendarWeeks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInCalendarWeeks.d.ts","sourceRoot":"","sources":["../src/differenceInCalendarWeeks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAC7B,WAAW,EAAE,QAAQ,CAAC,SAAS,EAC/B,OAAO,CAAC,EAAE,WAAW,GACpB,MAAM,CAAC;AACV,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACtD,OAAO,CAAC,EAAE,WAAW,GACpB,MAAM,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
differenceInCalendarWeeks
|
|
3
|
+
} from "./chunk-KZYWHHAQ.js";
|
|
4
|
+
import "./chunk-M2XB72L5.js";
|
|
5
|
+
import "./chunk-H43LMOCK.js";
|
|
6
|
+
import "./chunk-Q6QLOUXJ.js";
|
|
7
|
+
import "./chunk-BSVOJYJ7.js";
|
|
8
|
+
export {
|
|
9
|
+
differenceInCalendarWeeks
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=differenceInCalendarWeeks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Temporal } from './shared/temporal.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of calendar years between two dates, ignoring the month and
|
|
4
|
+
* day. Unlike differenceInYears, which counts complete years, December 31 to
|
|
5
|
+
* January 1 is one calendar year.
|
|
6
|
+
*
|
|
7
|
+
* PlainDate inputs are compared as given. Instant inputs use their UTC date and
|
|
8
|
+
* ZonedDateTime inputs use the date in their own timezone; convert both to one
|
|
9
|
+
* timezone first to count from a single point of view. Mixing a PlainDate with
|
|
10
|
+
* an Instant or ZonedDateTime throws a TypeError.
|
|
11
|
+
*
|
|
12
|
+
* @param laterDate - The later date
|
|
13
|
+
* @param earlierDate - The earlier date
|
|
14
|
+
* @returns Calendar years from earlierDate to laterDate; negative if laterDate is earlier
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const newYearsEve = Temporal.PlainDate.from('2024-12-31');
|
|
19
|
+
* const newYearsDay = Temporal.PlainDate.from('2025-01-01');
|
|
20
|
+
*
|
|
21
|
+
* differenceInCalendarYears(newYearsDay, newYearsEve); // 1
|
|
22
|
+
* differenceInYears(newYearsDay, newYearsEve); // 0
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function differenceInCalendarYears(laterDate: Temporal.PlainDate, earlierDate: Temporal.PlainDate): number;
|
|
26
|
+
export declare function differenceInCalendarYears(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
27
|
+
//# sourceMappingURL=differenceInCalendarYears.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInCalendarYears.d.ts","sourceRoot":"","sources":["../src/differenceInCalendarYears.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAC7B,WAAW,EAAE,QAAQ,CAAC,SAAS,GAC9B,MAAM,CAAC;AACV,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
differenceInCalendarYears
|
|
3
|
+
} from "./chunk-C7QA4J6V.js";
|
|
4
|
+
import "./chunk-H43LMOCK.js";
|
|
5
|
+
import "./chunk-Q6QLOUXJ.js";
|
|
6
|
+
import "./chunk-BSVOJYJ7.js";
|
|
7
|
+
export {
|
|
8
|
+
differenceInCalendarYears
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=differenceInCalendarYears.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { Temporal } from './shared/temporal.js';
|
|
2
|
+
import { type WeekOptions } from './shared/week.js';
|
|
2
3
|
/**
|
|
3
4
|
* PlainDate endpoints return date-only period starts in the start calendar.
|
|
4
5
|
* Mixed date-only/timeline endpoints are rejected. Reversed endpoints return [].
|
|
5
6
|
*
|
|
6
7
|
* Returns an array of ZonedDateTime objects for each week within the interval.
|
|
7
|
-
* Each element represents the first moment of the week (
|
|
8
|
-
*
|
|
8
|
+
* Each element represents the first moment of the week (midnight on its first day).
|
|
9
|
+
* Weeks start on Monday (ISO 8601) unless `weekStartsOn` says otherwise.
|
|
9
10
|
* The interval is inclusive of both start and end weeks.
|
|
10
11
|
*
|
|
11
12
|
* For Instant inputs, UTC is used as the timezone.
|
|
12
13
|
* For ZonedDateTime inputs, the timezone of the start date is preserved.
|
|
13
14
|
*
|
|
14
15
|
* @param interval - The interval with start and end datetimes
|
|
15
|
-
* @
|
|
16
|
+
* @param options - `weekStartsOn`: 1 = Monday (default) … 7 = Sunday
|
|
17
|
+
* @returns Array of ZonedDateTime at the start of each week in the interval
|
|
16
18
|
*
|
|
17
19
|
* @example
|
|
18
20
|
* ```ts
|
|
@@ -57,9 +59,9 @@ import { Temporal } from './shared/temporal.js';
|
|
|
57
59
|
export declare function eachWeekOfInterval(interval: {
|
|
58
60
|
start: Temporal.PlainDate;
|
|
59
61
|
end: Temporal.PlainDate;
|
|
60
|
-
}): Temporal.PlainDate[];
|
|
62
|
+
}, options?: WeekOptions): Temporal.PlainDate[];
|
|
61
63
|
export declare function eachWeekOfInterval(interval: {
|
|
62
64
|
start: Temporal.Instant | Temporal.ZonedDateTime;
|
|
63
65
|
end: Temporal.Instant | Temporal.ZonedDateTime;
|
|
64
|
-
}): Temporal.ZonedDateTime[];
|
|
66
|
+
}, options?: WeekOptions): Temporal.ZonedDateTime[];
|
|
65
67
|
//# sourceMappingURL=eachWeekOfInterval.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eachWeekOfInterval.d.ts","sourceRoot":"","sources":["../src/eachWeekOfInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"eachWeekOfInterval.d.ts","sourceRoot":"","sources":["../src/eachWeekOfInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,MAAM,mBAAmB,CAAC;AAI1D,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE;IAAE,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAC,SAAS,CAAA;CAAE,EAChE,OAAO,CAAC,EAAE,WAAW,GACpB,QAAQ,CAAC,SAAS,EAAE,CAAC;AACxB,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE;IACR,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC;IACjD,GAAG,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC;CAChD,EACD,OAAO,CAAC,EAAE,WAAW,GACpB,QAAQ,CAAC,aAAa,EAAE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
eachWeekOfInterval
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DYIISNVW.js";
|
|
4
4
|
import "./chunk-ZM32S3YU.js";
|
|
5
5
|
import "./chunk-ADPVFELS.js";
|
|
6
|
+
import "./chunk-M2XB72L5.js";
|
|
6
7
|
import "./chunk-Q6QLOUXJ.js";
|
|
7
8
|
import "./chunk-BSVOJYJ7.js";
|
|
8
9
|
export {
|
package/dist/endOfQuarter.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
endOfQuarter
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-XS2HUADA.js";
|
|
3
|
+
} from "./chunk-4FQCY75E.js";
|
|
5
4
|
import "./chunk-TCB3IDJM.js";
|
|
6
5
|
import "./chunk-NMMMAMKP.js";
|
|
7
6
|
import "./chunk-2AID4P2C.js";
|
|
7
|
+
import "./chunk-XS2HUADA.js";
|
|
8
8
|
import "./chunk-Q6QLOUXJ.js";
|
|
9
9
|
import "./chunk-BSVOJYJ7.js";
|
|
10
10
|
export {
|
package/dist/endOfWeek.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { type Temporal } from './shared/temporal.js';
|
|
2
2
|
import type { Timezone } from './types.js';
|
|
3
|
+
import { type WeekOptions } from './shared/week.js';
|
|
3
4
|
/**
|
|
4
|
-
* Returns the last boundary of the week
|
|
5
|
-
*
|
|
5
|
+
* Returns the last boundary of the week.
|
|
6
|
+
* Weeks start on Monday and end on Sunday (ISO 8601) unless `weekStartsOn` says otherwise.
|
|
6
7
|
* PlainDate inputs stay in calendar space unless a timezone is provided.
|
|
7
8
|
*
|
|
8
|
-
* @param input - A Temporal.Instant (UTC) or Temporal.
|
|
9
|
-
* @
|
|
9
|
+
* @param input - A Temporal.Instant (UTC), Temporal.ZonedDateTime, or Temporal.PlainDate
|
|
10
|
+
* @param options - `weekStartsOn`: 1 = Monday (default) … 7 = Sunday
|
|
11
|
+
* @returns The last day of the week at 23:59:59.999999999, or that date for PlainDate input
|
|
10
12
|
*
|
|
11
13
|
* @example
|
|
12
14
|
* ```ts
|
|
@@ -39,8 +41,16 @@ import type { Timezone } from './types.js';
|
|
|
39
41
|
* const end = endOfWeek(date, 'America/New_York');
|
|
40
42
|
* // 2025-01-26T23:59:59.999999999-05:00[America/New_York] (next Sunday)
|
|
41
43
|
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* // Weeks that start on Sunday end on Saturday
|
|
48
|
+
* const date = Temporal.PlainDate.from('2025-01-22'); // Wednesday
|
|
49
|
+
* const end = endOfWeek(date, { weekStartsOn: 7 });
|
|
50
|
+
* // 2025-01-25 (next Saturday)
|
|
51
|
+
* ```
|
|
42
52
|
*/
|
|
43
|
-
export declare function endOfWeek(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
|
|
44
|
-
export declare function endOfWeek(input: Temporal.PlainDate): Temporal.PlainDate;
|
|
45
|
-
export declare function endOfWeek(input: Temporal.PlainDate, timezone: Timezone): Temporal.ZonedDateTime;
|
|
53
|
+
export declare function endOfWeek(input: Temporal.Instant | Temporal.ZonedDateTime, options?: WeekOptions): Temporal.ZonedDateTime;
|
|
54
|
+
export declare function endOfWeek(input: Temporal.PlainDate, options?: WeekOptions): Temporal.PlainDate;
|
|
55
|
+
export declare function endOfWeek(input: Temporal.PlainDate, timezone: Timezone, options?: WeekOptions): Temporal.ZonedDateTime;
|
|
46
56
|
//# sourceMappingURL=endOfWeek.d.ts.map
|
package/dist/endOfWeek.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endOfWeek.d.ts","sourceRoot":"","sources":["../src/endOfWeek.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAe,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"endOfWeek.d.ts","sourceRoot":"","sources":["../src/endOfWeek.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAe,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxC,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChD,OAAO,CAAC,EAAE,WAAW,GACpB,QAAQ,CAAC,aAAa,CAAC;AAC1B,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC;AAChG,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,WAAW,GACpB,QAAQ,CAAC,aAAa,CAAC"}
|
package/dist/endOfWeek.js
CHANGED
package/dist/format.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAA0B,MAAM,mBAAmB,CAAC;AAE1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAA0B,MAAM,mBAAmB,CAAC;AAE1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAGjF,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,sBAAsB,GAAG;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,GACtD,MAAM,CAAC;AACV,wBAAgB,MAAM,CACpB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChD,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,aAAa,GACtB,MAAM,CAAC"}
|