@gobrand/tiempo 2.10.0 → 3.0.1
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/README.md +2 -2
- package/dist/addQuarters.d.ts +9 -9
- package/dist/addQuarters.d.ts.map +1 -1
- package/dist/addQuarters.js +1 -1
- package/dist/browserTimezone.d.ts +1 -1
- package/dist/chunk-25CVKMFC.js +21 -0
- package/dist/chunk-25CVKMFC.js.map +1 -0
- package/dist/{chunk-SDJJP4HW.js → chunk-3TS3D7WD.js} +4 -1
- package/dist/chunk-3TS3D7WD.js.map +1 -0
- package/dist/chunk-5Y5JH32Z.js +16 -0
- package/dist/chunk-5Y5JH32Z.js.map +1 -0
- package/dist/{chunk-KN45BU3W.js → chunk-7OEGJCW7.js} +10 -3
- package/dist/chunk-7OEGJCW7.js.map +1 -0
- package/dist/{chunk-XMW72PNW.js → chunk-7SCQV77A.js} +7 -1
- package/dist/chunk-7SCQV77A.js.map +1 -0
- package/dist/{chunk-5CFWMIHL.js → chunk-BV32K227.js} +7 -1
- package/dist/chunk-BV32K227.js.map +1 -0
- package/dist/chunk-GR7322AQ.js +20 -0
- package/dist/chunk-GR7322AQ.js.map +1 -0
- package/dist/chunk-KPB5ENNM.js +25 -0
- package/dist/chunk-KPB5ENNM.js.map +1 -0
- package/dist/{chunk-PVOGE6ME.js → chunk-MTDZG4HK.js} +4 -1
- package/dist/chunk-MTDZG4HK.js.map +1 -0
- package/dist/{chunk-SPK7C7RP.js → chunk-OSBVYUOQ.js} +13 -3
- package/dist/chunk-OSBVYUOQ.js.map +1 -0
- package/dist/{chunk-TGINH5JV.js → chunk-OVSCDXYN.js} +7 -1
- package/dist/chunk-OVSCDXYN.js.map +1 -0
- package/dist/{chunk-7HUJC5M6.js → chunk-S7L5KBI4.js} +4 -4
- package/dist/chunk-UQ2F3I2S.js +19 -0
- package/dist/chunk-UQ2F3I2S.js.map +1 -0
- package/dist/{chunk-RXTGHEHQ.js → chunk-VQAGV72H.js} +7 -6
- package/dist/chunk-VQAGV72H.js.map +1 -0
- package/dist/{chunk-VCWP3CZE.js → chunk-YNLBS34B.js} +9 -3
- package/dist/chunk-YNLBS34B.js.map +1 -0
- package/dist/chunk-YRCFMGBH.js +54 -0
- package/dist/chunk-YRCFMGBH.js.map +1 -0
- package/dist/differenceInDays.d.ts +2 -2
- package/dist/differenceInHours.d.ts +2 -2
- package/dist/differenceInMicroseconds.d.ts +1 -1
- package/dist/differenceInMilliseconds.d.ts +1 -1
- package/dist/differenceInMinutes.d.ts +2 -2
- package/dist/differenceInMonths.d.ts +2 -2
- package/dist/differenceInNanoseconds.d.ts +1 -1
- package/dist/differenceInQuarters.d.ts +13 -17
- package/dist/differenceInQuarters.d.ts.map +1 -1
- package/dist/differenceInQuarters.js +1 -1
- package/dist/differenceInSeconds.d.ts +2 -2
- package/dist/differenceInWeeks.d.ts +2 -2
- package/dist/differenceInYears.d.ts +2 -2
- package/dist/eachDayOfInterval.d.ts +1 -1
- package/dist/eachHourOfInterval.d.ts +1 -1
- package/dist/eachMinuteOfInterval.d.ts +1 -1
- package/dist/eachMonthOfInterval.d.ts +1 -1
- package/dist/eachQuarterOfInterval.d.ts +23 -27
- package/dist/eachQuarterOfInterval.d.ts.map +1 -1
- package/dist/eachQuarterOfInterval.js +1 -1
- package/dist/eachWeekOfInterval.d.ts +1 -1
- package/dist/eachYearOfInterval.d.ts +1 -1
- package/dist/endOfDay.d.ts +2 -2
- package/dist/endOfDay.js +2 -2
- package/dist/endOfMonth.d.ts +14 -4
- package/dist/endOfMonth.d.ts.map +1 -1
- package/dist/endOfMonth.js +2 -2
- package/dist/endOfQuarter.d.ts +3 -2
- package/dist/endOfQuarter.d.ts.map +1 -1
- package/dist/endOfQuarter.js +2 -2
- package/dist/endOfWeek.d.ts +13 -3
- package/dist/endOfWeek.d.ts.map +1 -1
- package/dist/endOfWeek.js +1 -1
- package/dist/endOfYear.d.ts +14 -4
- package/dist/endOfYear.d.ts.map +1 -1
- package/dist/endOfYear.js +2 -2
- package/dist/format.d.ts +1 -1
- package/dist/formatPlainDate.d.ts +1 -1
- package/dist/getQuarter.d.ts +8 -25
- package/dist/getQuarter.d.ts.map +1 -1
- package/dist/getQuarter.js +1 -3
- package/dist/index.d.ts +92 -92
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -23
- package/dist/isAfter.d.ts +1 -1
- package/dist/isBefore.d.ts +1 -1
- package/dist/isPlainDateAfter.d.ts +1 -1
- package/dist/isPlainDateBefore.d.ts +1 -1
- package/dist/isPlainDateEqual.d.ts +1 -1
- package/dist/isPlainTimeAfter.d.ts +1 -1
- package/dist/isPlainTimeBefore.d.ts +1 -1
- package/dist/isPlainTimeEqual.d.ts +1 -1
- package/dist/isSameDay.d.ts +1 -1
- package/dist/isSameQuarter.d.ts +12 -23
- package/dist/isSameQuarter.d.ts.map +1 -1
- package/dist/isSameQuarter.js +1 -1
- package/dist/isWithinInterval.d.ts +1 -1
- package/dist/now.d.ts +2 -2
- package/dist/shared/differenceInMilliseconds.d.ts +1 -1
- package/dist/shared/isAfter.d.ts +1 -1
- package/dist/shared/isBefore.d.ts +1 -1
- package/dist/shared/normalizeWithPlainDate.d.ts +1 -1
- package/dist/shared/nowZoned.d.ts +1 -1
- package/dist/shared/plainDateToZonedDateTime.d.ts +2 -2
- package/dist/shared/temporal.d.ts +1 -1
- package/dist/simpleFormat.d.ts +2 -2
- package/dist/startOfDay.d.ts +2 -2
- package/dist/startOfMonth.d.ts +14 -4
- package/dist/startOfMonth.d.ts.map +1 -1
- package/dist/startOfMonth.js +1 -1
- package/dist/startOfQuarter.d.ts +3 -2
- package/dist/startOfQuarter.d.ts.map +1 -1
- package/dist/startOfQuarter.js +1 -1
- package/dist/startOfWeek.d.ts +13 -3
- package/dist/startOfWeek.d.ts.map +1 -1
- package/dist/startOfWeek.js +1 -1
- package/dist/startOfYear.d.ts +14 -4
- package/dist/startOfYear.d.ts.map +1 -1
- package/dist/startOfYear.js +1 -1
- package/dist/subQuarters.d.ts +12 -5
- package/dist/subQuarters.d.ts.map +1 -1
- package/dist/subQuarters.js +2 -2
- package/dist/toInstant.d.ts +27 -0
- package/dist/toInstant.d.ts.map +1 -0
- package/dist/toInstant.js +8 -0
- package/dist/toPlainDate.d.ts +2 -2
- package/dist/toPlainTime.d.ts +2 -2
- package/dist/toZonedTime.d.ts +2 -2
- package/dist/today.d.ts +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +6 -4
- package/dist/addDays.test.d.ts +0 -2
- package/dist/addDays.test.d.ts.map +0 -1
- package/dist/addHours.test.d.ts +0 -2
- package/dist/addHours.test.d.ts.map +0 -1
- package/dist/addMicroseconds.test.d.ts +0 -2
- package/dist/addMicroseconds.test.d.ts.map +0 -1
- package/dist/addMilliseconds.test.d.ts +0 -2
- package/dist/addMilliseconds.test.d.ts.map +0 -1
- package/dist/addMinutes.test.d.ts +0 -2
- package/dist/addMinutes.test.d.ts.map +0 -1
- package/dist/addMonths.test.d.ts +0 -2
- package/dist/addMonths.test.d.ts.map +0 -1
- package/dist/addNanoseconds.test.d.ts +0 -2
- package/dist/addNanoseconds.test.d.ts.map +0 -1
- package/dist/addQuarters.test.d.ts +0 -2
- package/dist/addQuarters.test.d.ts.map +0 -1
- package/dist/addSeconds.test.d.ts +0 -2
- package/dist/addSeconds.test.d.ts.map +0 -1
- package/dist/addWeeks.test.d.ts +0 -2
- package/dist/addWeeks.test.d.ts.map +0 -1
- package/dist/addYears.test.d.ts +0 -2
- package/dist/addYears.test.d.ts.map +0 -1
- package/dist/browserTimezone.test.d.ts +0 -2
- package/dist/browserTimezone.test.d.ts.map +0 -1
- package/dist/chunk-5CFWMIHL.js.map +0 -1
- package/dist/chunk-6UBZ5YB3.js +0 -43
- package/dist/chunk-6UBZ5YB3.js.map +0 -1
- package/dist/chunk-FYZNOTX3.js +0 -18
- package/dist/chunk-FYZNOTX3.js.map +0 -1
- package/dist/chunk-KN45BU3W.js.map +0 -1
- package/dist/chunk-NOV3D7OM.js +0 -17
- package/dist/chunk-NOV3D7OM.js.map +0 -1
- package/dist/chunk-PVOGE6ME.js.map +0 -1
- package/dist/chunk-RXTGHEHQ.js.map +0 -1
- package/dist/chunk-SDJJP4HW.js.map +0 -1
- package/dist/chunk-SPK7C7RP.js.map +0 -1
- package/dist/chunk-TGINH5JV.js.map +0 -1
- package/dist/chunk-VCWP3CZE.js.map +0 -1
- package/dist/chunk-VUKOSQWW.js +0 -14
- package/dist/chunk-VUKOSQWW.js.map +0 -1
- package/dist/chunk-W5YDBBNF.js +0 -13
- package/dist/chunk-W5YDBBNF.js.map +0 -1
- package/dist/chunk-XMW72PNW.js.map +0 -1
- package/dist/chunk-ZEL6JBBH.js +0 -14
- package/dist/chunk-ZEL6JBBH.js.map +0 -1
- package/dist/differenceInDays.test.d.ts +0 -2
- package/dist/differenceInDays.test.d.ts.map +0 -1
- package/dist/differenceInHours.test.d.ts +0 -2
- package/dist/differenceInHours.test.d.ts.map +0 -1
- package/dist/differenceInMicroseconds.test.d.ts +0 -2
- package/dist/differenceInMicroseconds.test.d.ts.map +0 -1
- package/dist/differenceInMilliseconds.test.d.ts +0 -2
- package/dist/differenceInMilliseconds.test.d.ts.map +0 -1
- package/dist/differenceInMinutes.test.d.ts +0 -2
- package/dist/differenceInMinutes.test.d.ts.map +0 -1
- package/dist/differenceInMonths.test.d.ts +0 -2
- package/dist/differenceInMonths.test.d.ts.map +0 -1
- package/dist/differenceInNanoseconds.test.d.ts +0 -2
- package/dist/differenceInNanoseconds.test.d.ts.map +0 -1
- package/dist/differenceInQuarters.test.d.ts +0 -2
- package/dist/differenceInQuarters.test.d.ts.map +0 -1
- package/dist/differenceInSeconds.test.d.ts +0 -2
- package/dist/differenceInSeconds.test.d.ts.map +0 -1
- package/dist/differenceInWeeks.test.d.ts +0 -2
- package/dist/differenceInWeeks.test.d.ts.map +0 -1
- package/dist/differenceInYears.test.d.ts +0 -2
- package/dist/differenceInYears.test.d.ts.map +0 -1
- package/dist/eachDayOfInterval.test.d.ts +0 -2
- package/dist/eachDayOfInterval.test.d.ts.map +0 -1
- package/dist/eachHourOfInterval.test.d.ts +0 -2
- package/dist/eachHourOfInterval.test.d.ts.map +0 -1
- package/dist/eachMinuteOfInterval.test.d.ts +0 -2
- package/dist/eachMinuteOfInterval.test.d.ts.map +0 -1
- package/dist/eachMonthOfInterval.test.d.ts +0 -2
- package/dist/eachMonthOfInterval.test.d.ts.map +0 -1
- package/dist/eachQuarterOfInterval.test.d.ts +0 -2
- package/dist/eachQuarterOfInterval.test.d.ts.map +0 -1
- package/dist/eachWeekOfInterval.test.d.ts +0 -2
- package/dist/eachWeekOfInterval.test.d.ts.map +0 -1
- package/dist/eachYearOfInterval.test.d.ts +0 -2
- package/dist/eachYearOfInterval.test.d.ts.map +0 -1
- package/dist/endOfDay.test.d.ts +0 -2
- package/dist/endOfDay.test.d.ts.map +0 -1
- package/dist/endOfMonth.test.d.ts +0 -2
- package/dist/endOfMonth.test.d.ts.map +0 -1
- package/dist/endOfQuarter.test.d.ts +0 -2
- package/dist/endOfQuarter.test.d.ts.map +0 -1
- package/dist/endOfWeek.test.d.ts +0 -2
- package/dist/endOfWeek.test.d.ts.map +0 -1
- package/dist/endOfYear.test.d.ts +0 -2
- package/dist/endOfYear.test.d.ts.map +0 -1
- package/dist/format.test.d.ts +0 -2
- package/dist/format.test.d.ts.map +0 -1
- package/dist/formatPlainDate.test.d.ts +0 -2
- package/dist/formatPlainDate.test.d.ts.map +0 -1
- package/dist/getQuarter.test.d.ts +0 -2
- package/dist/getQuarter.test.d.ts.map +0 -1
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
- package/dist/intlFormatDistance.test.d.ts +0 -2
- package/dist/intlFormatDistance.test.d.ts.map +0 -1
- package/dist/isAfter.test.d.ts +0 -2
- package/dist/isAfter.test.d.ts.map +0 -1
- package/dist/isBefore.test.d.ts +0 -2
- package/dist/isBefore.test.d.ts.map +0 -1
- package/dist/isFuture.test.d.ts +0 -2
- package/dist/isFuture.test.d.ts.map +0 -1
- package/dist/isPast.test.d.ts +0 -2
- package/dist/isPast.test.d.ts.map +0 -1
- package/dist/isPlainDateAfter.test.d.ts +0 -2
- package/dist/isPlainDateAfter.test.d.ts.map +0 -1
- package/dist/isPlainDateBefore.test.d.ts +0 -2
- package/dist/isPlainDateBefore.test.d.ts.map +0 -1
- package/dist/isPlainDateEqual.test.d.ts +0 -2
- package/dist/isPlainDateEqual.test.d.ts.map +0 -1
- package/dist/isPlainTimeAfter.test.d.ts +0 -2
- package/dist/isPlainTimeAfter.test.d.ts.map +0 -1
- package/dist/isPlainTimeBefore.test.d.ts +0 -2
- package/dist/isPlainTimeBefore.test.d.ts.map +0 -1
- package/dist/isPlainTimeEqual.test.d.ts +0 -2
- package/dist/isPlainTimeEqual.test.d.ts.map +0 -1
- package/dist/isSameDay.test.d.ts +0 -2
- package/dist/isSameDay.test.d.ts.map +0 -1
- package/dist/isSameHour.test.d.ts +0 -2
- package/dist/isSameHour.test.d.ts.map +0 -1
- package/dist/isSameMicrosecond.test.d.ts +0 -2
- package/dist/isSameMicrosecond.test.d.ts.map +0 -1
- package/dist/isSameMillisecond.test.d.ts +0 -2
- package/dist/isSameMillisecond.test.d.ts.map +0 -1
- package/dist/isSameMinute.test.d.ts +0 -2
- package/dist/isSameMinute.test.d.ts.map +0 -1
- package/dist/isSameMonth.test.d.ts +0 -2
- package/dist/isSameMonth.test.d.ts.map +0 -1
- package/dist/isSameNanosecond.test.d.ts +0 -2
- package/dist/isSameNanosecond.test.d.ts.map +0 -1
- package/dist/isSameQuarter.test.d.ts +0 -2
- package/dist/isSameQuarter.test.d.ts.map +0 -1
- package/dist/isSameSecond.test.d.ts +0 -2
- package/dist/isSameSecond.test.d.ts.map +0 -1
- package/dist/isSameWeek.test.d.ts +0 -2
- package/dist/isSameWeek.test.d.ts.map +0 -1
- package/dist/isSameYear.test.d.ts +0 -2
- package/dist/isSameYear.test.d.ts.map +0 -1
- package/dist/isWithinInterval.test.d.ts +0 -2
- package/dist/isWithinInterval.test.d.ts.map +0 -1
- package/dist/now.test.d.ts +0 -2
- package/dist/now.test.d.ts.map +0 -1
- package/dist/roundToNearestHour.test.d.ts +0 -2
- package/dist/roundToNearestHour.test.d.ts.map +0 -1
- package/dist/roundToNearestMinute.test.d.ts +0 -2
- package/dist/roundToNearestMinute.test.d.ts.map +0 -1
- package/dist/roundToNearestSecond.test.d.ts +0 -2
- package/dist/roundToNearestSecond.test.d.ts.map +0 -1
- package/dist/shared/temporal.test.d.ts +0 -2
- package/dist/shared/temporal.test.d.ts.map +0 -1
- package/dist/simpleFormat.test.d.ts +0 -2
- package/dist/simpleFormat.test.d.ts.map +0 -1
- package/dist/startOfDay.test.d.ts +0 -2
- package/dist/startOfDay.test.d.ts.map +0 -1
- package/dist/startOfMonth.test.d.ts +0 -2
- package/dist/startOfMonth.test.d.ts.map +0 -1
- package/dist/startOfQuarter.test.d.ts +0 -2
- package/dist/startOfQuarter.test.d.ts.map +0 -1
- package/dist/startOfWeek.test.d.ts +0 -2
- package/dist/startOfWeek.test.d.ts.map +0 -1
- package/dist/startOfYear.test.d.ts +0 -2
- package/dist/startOfYear.test.d.ts.map +0 -1
- package/dist/subDays.test.d.ts +0 -2
- package/dist/subDays.test.d.ts.map +0 -1
- package/dist/subHours.test.d.ts +0 -2
- package/dist/subHours.test.d.ts.map +0 -1
- package/dist/subMicroseconds.test.d.ts +0 -2
- package/dist/subMicroseconds.test.d.ts.map +0 -1
- package/dist/subMilliseconds.test.d.ts +0 -2
- package/dist/subMilliseconds.test.d.ts.map +0 -1
- package/dist/subMinutes.test.d.ts +0 -2
- package/dist/subMinutes.test.d.ts.map +0 -1
- package/dist/subMonths.test.d.ts +0 -2
- package/dist/subMonths.test.d.ts.map +0 -1
- package/dist/subNanoseconds.test.d.ts +0 -2
- package/dist/subNanoseconds.test.d.ts.map +0 -1
- package/dist/subQuarters.test.d.ts +0 -2
- package/dist/subQuarters.test.d.ts.map +0 -1
- package/dist/subSeconds.test.d.ts +0 -2
- package/dist/subSeconds.test.d.ts.map +0 -1
- package/dist/subWeeks.test.d.ts +0 -2
- package/dist/subWeeks.test.d.ts.map +0 -1
- package/dist/subYears.test.d.ts +0 -2
- package/dist/subYears.test.d.ts.map +0 -1
- package/dist/toDate.test.d.ts +0 -2
- package/dist/toDate.test.d.ts.map +0 -1
- package/dist/toIso.test.d.ts +0 -2
- package/dist/toIso.test.d.ts.map +0 -1
- package/dist/toIso9075.test.d.ts +0 -2
- package/dist/toIso9075.test.d.ts.map +0 -1
- package/dist/toPlainDate.test.d.ts +0 -2
- package/dist/toPlainDate.test.d.ts.map +0 -1
- package/dist/toPlainTime.test.d.ts +0 -2
- package/dist/toPlainTime.test.d.ts.map +0 -1
- package/dist/toUtc.d.ts +0 -27
- package/dist/toUtc.d.ts.map +0 -1
- package/dist/toUtc.js +0 -8
- package/dist/toUtc.test.d.ts +0 -2
- package/dist/toUtc.test.d.ts.map +0 -1
- package/dist/toZonedTime.test.d.ts +0 -2
- package/dist/toZonedTime.test.d.ts.map +0 -1
- package/dist/today.test.d.ts +0 -2
- package/dist/today.test.d.ts.map +0 -1
- /package/dist/{chunk-7HUJC5M6.js.map → chunk-S7L5KBI4.js.map} +0 -0
- /package/dist/{toUtc.js.map → toInstant.js.map} +0 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
**Timezone conversions that don't suck.** Built on the [Temporal API](https://tc39.es/proposal-temporal/docs/).
|
|
8
8
|
|
|
9
|
-
👉 **[Documentation](https://
|
|
9
|
+
👉 **[Documentation](https://tiempo.gobrand.app)**
|
|
10
10
|
|
|
11
11
|

|
|
12
12
|
|
|
@@ -40,7 +40,7 @@ npm install @gobrand/tiempo
|
|
|
40
40
|
|
|
41
41
|
## Docs
|
|
42
42
|
|
|
43
|
-
**[
|
|
43
|
+
**[tiempo.gobrand.app](https://tiempo.gobrand.app)** — Full API reference, examples, and guides.
|
|
44
44
|
|
|
45
45
|
## License
|
|
46
46
|
|
package/dist/addQuarters.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import type { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
/**
|
|
3
|
-
* Adds the specified number of quarters (3-month blocks) to a datetime.
|
|
3
|
+
* Adds the specified number of quarters (3-month blocks) to a datetime or date.
|
|
4
4
|
*
|
|
5
5
|
* Properly handles month-end dates and calendar edge cases through Temporal API.
|
|
6
|
-
* Instant inputs are converted to UTC
|
|
6
|
+
* Instant inputs are converted to UTC; ZonedDateTime inputs preserve their
|
|
7
|
+
* timezone. PlainDate inputs stay in calendar space and return a PlainDate.
|
|
7
8
|
*
|
|
8
9
|
* @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime
|
|
9
10
|
* @param quarters - Number of quarters to add (can be negative to subtract)
|
|
10
|
-
* @returns ZonedDateTime
|
|
11
|
+
* @returns A ZonedDateTime (for Instant/ZonedDateTime) with the quarters added
|
|
11
12
|
*
|
|
12
13
|
* @example
|
|
13
14
|
* ```ts
|
|
14
|
-
* // From Instant (always UTC)
|
|
15
15
|
* const instant = Temporal.Instant.from('2025-01-20T12:00:00Z');
|
|
16
|
-
*
|
|
16
|
+
* addQuarters(instant, 2);
|
|
17
17
|
* // 2025-07-20T12:00:00Z[UTC] (6 months later)
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* ```ts
|
|
22
|
-
* //
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* // 2025-04-20T15:30:00-04:00[America/New_York]
|
|
22
|
+
* // Calendar arithmetic on a date stays a date
|
|
23
|
+
* addQuarters(Temporal.PlainDate.from('2025-01-31'), 1);
|
|
24
|
+
* // 2025-04-30 (Jan 31 → Apr 30)
|
|
26
25
|
* ```
|
|
27
26
|
*/
|
|
28
27
|
export declare function addQuarters(input: Temporal.Instant | Temporal.ZonedDateTime, quarters: number): Temporal.ZonedDateTime;
|
|
28
|
+
export declare function addQuarters(input: Temporal.PlainDate, quarters: number): Temporal.PlainDate;
|
|
29
29
|
//# sourceMappingURL=addQuarters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addQuarters.d.ts","sourceRoot":"","sources":["../src/addQuarters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"addQuarters.d.ts","sourceRoot":"","sources":["../src/addQuarters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChD,QAAQ,EAAE,MAAM,GACf,QAAQ,CAAC,aAAa,CAAC;AAC1B,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC"}
|
package/dist/addQuarters.js
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
quarterOfMonth
|
|
3
|
+
} from "./chunk-XS2HUADA.js";
|
|
4
|
+
import {
|
|
5
|
+
normalizeTemporalInput
|
|
6
|
+
} from "./chunk-NTMT5XGC.js";
|
|
7
|
+
import {
|
|
8
|
+
isPlainDate
|
|
9
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
10
|
+
|
|
11
|
+
// src/isSameQuarter.ts
|
|
12
|
+
function isSameQuarter(date1, date2) {
|
|
13
|
+
const a = isPlainDate(date1) ? date1 : normalizeTemporalInput(date1);
|
|
14
|
+
const b = isPlainDate(date2) ? date2 : normalizeTemporalInput(date2);
|
|
15
|
+
return a.year === b.year && quarterOfMonth(a.month) === quarterOfMonth(b.month);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
isSameQuarter
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=chunk-25CVKMFC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/isSameQuarter.ts"],"sourcesContent":["import type { Temporal } from \"@js-temporal/polyfill\";\nimport { isPlainDate } from \"./shared/temporal\";\nimport { normalizeTemporalInput } from \"./shared/normalizeTemporalInput\";\nimport { quarterOfMonth } from \"./shared/quarter\";\n\n/**\n * Returns true if both inputs fall in the same calendar quarter and year.\n *\n * Quarters: Q1 = Jan–Mar, Q2 = Apr–Jun, Q3 = Jul–Sep, Q4 = Oct–Dec.\n *\n * Instant inputs are converted to UTC; ZonedDateTime inputs keep their own\n * timezone. PlainDate inputs are compared directly — a quarter is intrinsic to\n * the calendar date, so no timezone is needed.\n *\n * @param date1 - First Instant or ZonedDateTime\n * @param date2 - Second Instant or ZonedDateTime\n * @returns true if both are in the same calendar quarter, false otherwise\n *\n * @example\n * ```ts\n * const jan = Temporal.ZonedDateTime.from('2025-01-15T08:00:00Z[UTC]');\n * const mar = Temporal.ZonedDateTime.from('2025-03-31T23:59:59Z[UTC]');\n * isSameQuarter(jan, mar); // true\n * ```\n *\n * @example\n * ```ts\n * // PlainDate comparison needs no timezone\n * const a = Temporal.PlainDate.from('2025-04-05');\n * const b = Temporal.PlainDate.from('2025-06-28');\n * isSameQuarter(a, b); // true (both Q2)\n * ```\n */\nexport function isSameQuarter(\n date1: Temporal.Instant | Temporal.ZonedDateTime,\n date2: Temporal.Instant | Temporal.ZonedDateTime,\n): boolean;\nexport function isSameQuarter(date1: Temporal.PlainDate, date2: Temporal.PlainDate): boolean;\nexport function isSameQuarter(\n date1: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n date2: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n): boolean {\n const a = isPlainDate(date1) ? date1 : normalizeTemporalInput(date1);\n const b = isPlainDate(date2) ? date2 : normalizeTemporalInput(date2);\n\n return a.year === b.year && quarterOfMonth(a.month) === quarterOfMonth(b.month);\n}\n"],"mappings":";;;;;;;;;;;AAsCO,SAAS,cACd,OACA,OACS;AACT,QAAM,IAAI,YAAY,KAAK,IAAI,QAAQ,uBAAuB,KAAK;AACnE,QAAM,IAAI,YAAY,KAAK,IAAI,QAAQ,uBAAuB,KAAK;AAEnE,SAAO,EAAE,SAAS,EAAE,QAAQ,eAAe,EAAE,KAAK,MAAM,eAAe,EAAE,KAAK;AAChF;","names":[]}
|
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
|
|
11
11
|
// src/startOfWeek.ts
|
|
12
12
|
function startOfWeek(input, timezone) {
|
|
13
|
+
if (isPlainDate(input) && timezone === void 0) {
|
|
14
|
+
return input.subtract({ days: input.dayOfWeek - 1 });
|
|
15
|
+
}
|
|
13
16
|
const zonedDateTime = isPlainDate(input) ? plainDateToZonedDateTime(input, timezone) : normalizeTemporalInput(input);
|
|
14
17
|
const dayOfWeek = zonedDateTime.dayOfWeek;
|
|
15
18
|
const daysToSubtract = dayOfWeek - 1;
|
|
@@ -20,4 +23,4 @@ function startOfWeek(input, timezone) {
|
|
|
20
23
|
export {
|
|
21
24
|
startOfWeek
|
|
22
25
|
};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-3TS3D7WD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/startOfWeek.ts"],"sourcesContent":["import { isPlainDate } from './shared/temporal';\nimport type { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { plainDateToZonedDateTime } from './shared/plainDateToZonedDateTime';\n\n/**\n * Returns the first boundary of the week (Monday).\n * Uses ISO 8601 week definition: weeks start on Monday.\n * PlainDate inputs stay in calendar space unless a timezone is provided.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at Monday 00:00:00.000000000\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:00Z[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 */\nexport function startOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime;\nexport function startOfWeek(input: Temporal.PlainDate): Temporal.PlainDate;\nexport function startOfWeek(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function startOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n if (isPlainDate(input) && timezone === undefined) {\n return input.subtract({ days: input.dayOfWeek - 1 });\n }\n\n const zonedDateTime =\n isPlainDate(input)\n ? plainDateToZonedDateTime(input, timezone!)\n : normalizeTemporalInput(input);\n\n // Get the day of week (1 = Monday, 7 = Sunday in ISO 8601)\n const dayOfWeek = zonedDateTime.dayOfWeek;\n\n // Calculate days to subtract to get to Monday\n const daysToSubtract = dayOfWeek - 1;\n\n // Go to Monday, then get start of that day\n const monday = zonedDateTime.subtract({ days: daysToSubtract });\n\n return monday.startOfDay();\n}\n"],"mappings":";;;;;;;;;;;AAsDO,SAAS,YACd,OACA,UAC6C;AAC7C,MAAI,YAAY,KAAK,KAAK,aAAa,QAAW;AAChD,WAAO,MAAM,SAAS,EAAE,MAAM,MAAM,YAAY,EAAE,CAAC;AAAA,EACrD;AAEA,QAAM,gBACJ,YAAY,KAAK,IACb,yBAAyB,OAAO,QAAS,IACzC,uBAAuB,KAAK;AAGlC,QAAM,YAAY,cAAc;AAGhC,QAAM,iBAAiB,YAAY;AAGnC,QAAM,SAAS,cAAc,SAAS,EAAE,MAAM,eAAe,CAAC;AAE9D,SAAO,OAAO,WAAW;AAC3B;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addQuarters
|
|
3
|
+
} from "./chunk-UQ2F3I2S.js";
|
|
4
|
+
import {
|
|
5
|
+
isPlainDate
|
|
6
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
7
|
+
|
|
8
|
+
// src/subQuarters.ts
|
|
9
|
+
function subQuarters(input, quarters) {
|
|
10
|
+
return isPlainDate(input) ? addQuarters(input, -quarters) : addQuarters(input, -quarters);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
subQuarters
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-5Y5JH32Z.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/subQuarters.ts"],"sourcesContent":["import type { Temporal } from \"@js-temporal/polyfill\";\nimport { isPlainDate } from \"./shared/temporal\";\nimport { addQuarters } from \"./addQuarters\";\n\n/**\n * Subtracts the specified number of quarters (3-month blocks) from a datetime or date.\n *\n * This is a convenience wrapper around addQuarters with the count negated.\n * PlainDate inputs stay in calendar space and return a PlainDate.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @param quarters - Number of quarters to subtract\n * @returns A ZonedDateTime (for Instant/ZonedDateTime) with the quarters subtracted\n *\n * @example\n * ```ts\n * const instant = Temporal.Instant.from('2025-07-20T12:00:00Z');\n * subQuarters(instant, 2);\n * // 2025-01-20T12:00:00Z[UTC] (6 months earlier)\n * ```\n *\n * @example\n * ```ts\n * subQuarters(Temporal.PlainDate.from('2025-07-20'), 1);\n * // 2025-04-20\n * ```\n */\nexport function subQuarters(\n input: Temporal.Instant | Temporal.ZonedDateTime,\n quarters: number,\n): Temporal.ZonedDateTime;\nexport function subQuarters(input: Temporal.PlainDate, quarters: number): Temporal.PlainDate;\nexport function subQuarters(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n quarters: number,\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n // Branch so each call resolves to the matching addQuarters overload.\n return isPlainDate(input) ? addQuarters(input, -quarters) : addQuarters(input, -quarters);\n}\n"],"mappings":";;;;;;;;AAgCO,SAAS,YACd,OACA,UAC6C;AAE7C,SAAO,YAAY,KAAK,IAAI,YAAY,OAAO,CAAC,QAAQ,IAAI,YAAY,OAAO,CAAC,QAAQ;AAC1F;","names":[]}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeWithPlainDate
|
|
3
|
+
} from "./chunk-ZOHYNJUD.js";
|
|
1
4
|
import {
|
|
2
5
|
getEndOfDay
|
|
3
6
|
} from "./chunk-AVGNRINZ.js";
|
|
4
7
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
8
|
+
isPlainDate
|
|
9
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
7
10
|
|
|
8
11
|
// src/endOfYear.ts
|
|
9
12
|
function endOfYear(input, timezone) {
|
|
13
|
+
if (isPlainDate(input) && timezone === void 0) {
|
|
14
|
+
const lastMonth2 = input.with({ month: input.monthsInYear });
|
|
15
|
+
return lastMonth2.with({ day: lastMonth2.daysInMonth });
|
|
16
|
+
}
|
|
10
17
|
const zonedDateTime = normalizeWithPlainDate(input, timezone);
|
|
11
18
|
const lastMonth = zonedDateTime.with({ month: zonedDateTime.monthsInYear });
|
|
12
19
|
const lastDay = lastMonth.with({ day: lastMonth.daysInMonth });
|
|
@@ -16,4 +23,4 @@ function endOfYear(input, timezone) {
|
|
|
16
23
|
export {
|
|
17
24
|
endOfYear
|
|
18
25
|
};
|
|
19
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-7OEGJCW7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/endOfYear.ts"],"sourcesContent":["import { isPlainDate, Temporal } from './shared/temporal';\nimport type { Timezone } from './types';\nimport { getEndOfDay } from './shared/endOfDay';\nimport { normalizeWithPlainDate } from './shared/normalizeWithPlainDate';\n\n/**\n * Returns the last boundary of the year.\n * PlainDate inputs stay in calendar space unless a timezone is provided.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at the last day of the year at 23:59:59.999999999\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-06-15T12:00:00Z');\n * const end = endOfYear(instant);\n * // 2025-12-31T23:59:59.999999999Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-06-15T15:30:00-05:00[America/New_York]');\n * const end = endOfYear(zoned);\n * // 2025-12-31T23:59:59.999999999-05:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate (stays a date)\n * const date = Temporal.PlainDate.from('2025-06-15');\n * const end = endOfYear(date);\n * // 2025-12-31\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate with a timezone (returns a ZonedDateTime)\n * const date = Temporal.PlainDate.from('2025-06-15');\n * const end = endOfYear(date, 'America/New_York');\n * // 2025-12-31T23:59:59.999999999-05:00[America/New_York]\n * ```\n */\nexport function endOfYear(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime;\nexport function endOfYear(input: Temporal.PlainDate): Temporal.PlainDate;\nexport function endOfYear(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function endOfYear(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n if (isPlainDate(input) && timezone === undefined) {\n const lastMonth = input.with({ month: input.monthsInYear });\n return lastMonth.with({ day: lastMonth.daysInMonth });\n }\n\n const zonedDateTime = normalizeWithPlainDate(input, timezone!);\n const lastMonth = zonedDateTime.with({ month: zonedDateTime.monthsInYear });\n const lastDay = lastMonth.with({ day: lastMonth.daysInMonth });\n return getEndOfDay(lastDay);\n}\n"],"mappings":";;;;;;;;;;;AAoDO,SAAS,UACd,OACA,UAC6C;AAC7C,MAAI,YAAY,KAAK,KAAK,aAAa,QAAW;AAChD,UAAMA,aAAY,MAAM,KAAK,EAAE,OAAO,MAAM,aAAa,CAAC;AAC1D,WAAOA,WAAU,KAAK,EAAE,KAAKA,WAAU,YAAY,CAAC;AAAA,EACtD;AAEA,QAAM,gBAAgB,uBAAuB,OAAO,QAAS;AAC7D,QAAM,YAAY,cAAc,KAAK,EAAE,OAAO,cAAc,aAAa,CAAC;AAC1E,QAAM,UAAU,UAAU,KAAK,EAAE,KAAK,UAAU,YAAY,CAAC;AAC7D,SAAO,YAAY,OAAO;AAC5B;","names":["lastMonth"]}
|
|
@@ -4,9 +4,15 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
normalizeWithPlainDate
|
|
6
6
|
} from "./chunk-ZOHYNJUD.js";
|
|
7
|
+
import {
|
|
8
|
+
isPlainDate
|
|
9
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
7
10
|
|
|
8
11
|
// src/startOfQuarter.ts
|
|
9
12
|
function startOfQuarter(input, timezone) {
|
|
13
|
+
if (isPlainDate(input) && timezone === void 0) {
|
|
14
|
+
return input.with({ month: quarterStartMonth(input.month), day: 1 });
|
|
15
|
+
}
|
|
10
16
|
const zonedDateTime = normalizeWithPlainDate(input, timezone);
|
|
11
17
|
const firstDay = zonedDateTime.with({
|
|
12
18
|
month: quarterStartMonth(zonedDateTime.month),
|
|
@@ -18,4 +24,4 @@ function startOfQuarter(input, timezone) {
|
|
|
18
24
|
export {
|
|
19
25
|
startOfQuarter
|
|
20
26
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-7SCQV77A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/startOfQuarter.ts"],"sourcesContent":["import { isPlainDate } from \"./shared/temporal\";\nimport type { Temporal } from \"@js-temporal/polyfill\";\nimport type { Timezone } from \"./types\";\nimport { normalizeWithPlainDate } from \"./shared/normalizeWithPlainDate\";\nimport { quarterStartMonth } from \"./shared/quarter\";\n\n/**\n * Returns a ZonedDateTime representing the first moment of the quarter\n * (first day of the quarter's starting month at midnight).\n *\n * Quarters: Q1 = Jan–Mar, Q2 = Apr–Jun, Q3 = Jul–Sep, Q4 = Oct–Dec.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at the 1st day of the quarter at 00:00:00.000000000\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-05-15T12:00:00Z');\n * const start = startOfQuarter(instant);\n * // 2025-04-01T00:00:00Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-08-15T15:30:00-05:00[America/New_York]');\n * const start = startOfQuarter(zoned);\n * // 2025-07-01T00:00:00-04:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate (requires timezone)\n * const date = Temporal.PlainDate.from('2025-11-15');\n * const start = startOfQuarter(date, 'America/New_York');\n * // 2025-10-01T00:00:00-04:00[America/New_York]\n * ```\n */\nexport function startOfQuarter(\n input: Temporal.Instant | Temporal.ZonedDateTime,\n): Temporal.ZonedDateTime;\nexport function startOfQuarter(input: Temporal.PlainDate): Temporal.PlainDate;\nexport function startOfQuarter(\n input: Temporal.PlainDate,\n timezone: Timezone,\n): Temporal.ZonedDateTime;\nexport function startOfQuarter(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone,\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n // PlainDate with no timezone stays in calendar space → first day of quarter.\n if (isPlainDate(input) && timezone === undefined) {\n return input.with({ month: quarterStartMonth(input.month), day: 1 });\n }\n const zonedDateTime = normalizeWithPlainDate(input, timezone!);\n const firstDay = zonedDateTime.with({\n month: quarterStartMonth(zonedDateTime.month),\n day: 1,\n });\n return firstDay.startOfDay();\n}\n"],"mappings":";;;;;;;;;;;AA+CO,SAAS,eACd,OACA,UAC6C;AAE7C,MAAI,YAAY,KAAK,KAAK,aAAa,QAAW;AAChD,WAAO,MAAM,KAAK,EAAE,OAAO,kBAAkB,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC;AAAA,EACrE;AACA,QAAM,gBAAgB,uBAAuB,OAAO,QAAS;AAC7D,QAAM,WAAW,cAAc,KAAK;AAAA,IAClC,OAAO,kBAAkB,cAAc,KAAK;AAAA,IAC5C,KAAK;AAAA,EACP,CAAC;AACD,SAAO,SAAS,WAAW;AAC7B;","names":[]}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeWithPlainDate
|
|
3
3
|
} from "./chunk-ZOHYNJUD.js";
|
|
4
|
+
import {
|
|
5
|
+
isPlainDate
|
|
6
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
4
7
|
|
|
5
8
|
// src/startOfMonth.ts
|
|
6
9
|
function startOfMonth(input, timezone) {
|
|
10
|
+
if (isPlainDate(input) && timezone === void 0) {
|
|
11
|
+
return input.with({ day: 1 });
|
|
12
|
+
}
|
|
7
13
|
const zonedDateTime = normalizeWithPlainDate(input, timezone);
|
|
8
14
|
const firstDay = zonedDateTime.with({ day: 1 });
|
|
9
15
|
return firstDay.startOfDay();
|
|
@@ -12,4 +18,4 @@ function startOfMonth(input, timezone) {
|
|
|
12
18
|
export {
|
|
13
19
|
startOfMonth
|
|
14
20
|
};
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-BV32K227.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/startOfMonth.ts"],"sourcesContent":["import { isPlainDate, Temporal } from './shared/temporal';\nimport type { Timezone } from './types';\nimport { normalizeWithPlainDate } from './shared/normalizeWithPlainDate';\n\n/**\n * Returns the first boundary of the month.\n * PlainDate inputs stay in calendar space unless a timezone is provided.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at the 1st day of the month at 00:00:00.000000000\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-01-15T12:00:00Z');\n * const start = startOfMonth(instant);\n * // 2025-01-01T00:00:00Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-01-15T15:30:00-05:00[America/New_York]');\n * const start = startOfMonth(zoned);\n * // 2025-01-01T00:00:00-05:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate (stays a date)\n * const date = Temporal.PlainDate.from('2025-01-15');\n * const start = startOfMonth(date);\n * // 2025-01-01\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate with a timezone (returns a ZonedDateTime)\n * const date = Temporal.PlainDate.from('2025-01-15');\n * const start = startOfMonth(date, 'America/New_York');\n * // 2025-01-01T00:00:00-05:00[America/New_York]\n * ```\n */\nexport function startOfMonth(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime;\nexport function startOfMonth(input: Temporal.PlainDate): Temporal.PlainDate;\nexport function startOfMonth(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function startOfMonth(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n if (isPlainDate(input) && timezone === undefined) {\n return input.with({ day: 1 });\n }\n\n const zonedDateTime = normalizeWithPlainDate(input, timezone!);\n const firstDay = zonedDateTime.with({ day: 1 });\n return firstDay.startOfDay();\n}\n"],"mappings":";;;;;;;;AAmDO,SAAS,aACd,OACA,UAC6C;AAC7C,MAAI,YAAY,KAAK,KAAK,aAAa,QAAW;AAChD,WAAO,MAAM,KAAK,EAAE,KAAK,EAAE,CAAC;AAAA,EAC9B;AAEA,QAAM,gBAAgB,uBAAuB,OAAO,QAAS;AAC7D,QAAM,WAAW,cAAc,KAAK,EAAE,KAAK,EAAE,CAAC;AAC9C,SAAO,SAAS,WAAW;AAC7B;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
quarterOfMonth
|
|
3
|
+
} from "./chunk-XS2HUADA.js";
|
|
4
|
+
import {
|
|
5
|
+
normalizeTemporalInput
|
|
6
|
+
} from "./chunk-NTMT5XGC.js";
|
|
7
|
+
import {
|
|
8
|
+
isPlainDate
|
|
9
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
10
|
+
|
|
11
|
+
// src/getQuarter.ts
|
|
12
|
+
function getQuarter(input) {
|
|
13
|
+
const month = isPlainDate(input) ? input.month : normalizeTemporalInput(input).month;
|
|
14
|
+
return quarterOfMonth(month);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
getQuarter
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=chunk-GR7322AQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/getQuarter.ts"],"sourcesContent":["import type { Temporal } from \"@js-temporal/polyfill\";\nimport { isPlainDate } from \"./shared/temporal\";\nimport { normalizeTemporalInput } from \"./shared/normalizeTemporalInput\";\nimport { quarterOfMonth } from \"./shared/quarter\";\n\n/**\n * Returns the quarter (1-4) that a datetime or date falls in.\n *\n * Quarters: Q1 = Jan–Mar, Q2 = Apr–Jun, Q3 = Jul–Sep, Q4 = Oct–Dec.\n *\n * A quarter is intrinsic to the calendar date, so no timezone is ever needed.\n * `Instant` inputs are interpreted in UTC; `ZonedDateTime` inputs use their own\n * timezone; `PlainDate` inputs use their calendar month directly.\n *\n * @param input - A Temporal.Instant (UTC), Temporal.ZonedDateTime, or Temporal.PlainDate\n * @returns The quarter number: 1, 2, 3, or 4\n *\n * @example\n * ```ts\n * getQuarter(Temporal.Instant.from('2025-05-15T12:00:00Z')); // 2\n * getQuarter(Temporal.PlainDate.from('2025-11-15')); // 4\n * ```\n */\nexport function getQuarter(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n): 1 | 2 | 3 | 4 {\n const month = isPlainDate(input) ? input.month : normalizeTemporalInput(input).month;\n return quarterOfMonth(month);\n}\n"],"mappings":";;;;;;;;;;;AAuBO,SAAS,WACd,OACe;AACf,QAAM,QAAQ,YAAY,KAAK,IAAI,MAAM,QAAQ,uBAAuB,KAAK,EAAE;AAC/E,SAAO,eAAe,KAAK;AAC7B;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
differenceInMonths
|
|
3
|
+
} from "./chunk-CIA46DWB.js";
|
|
4
|
+
import {
|
|
5
|
+
isPlainDate
|
|
6
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
7
|
+
|
|
8
|
+
// src/differenceInQuarters.ts
|
|
9
|
+
function differenceInQuarters(laterDate, earlierDate, options) {
|
|
10
|
+
const months = isPlainDate(laterDate) && isPlainDate(earlierDate) ? earlierDate.until(laterDate).total({
|
|
11
|
+
unit: "months",
|
|
12
|
+
relativeTo: earlierDate
|
|
13
|
+
}) : differenceInMonths(
|
|
14
|
+
laterDate,
|
|
15
|
+
earlierDate,
|
|
16
|
+
{ fractional: true }
|
|
17
|
+
);
|
|
18
|
+
const quarters = months / 3;
|
|
19
|
+
return options?.fractional ? quarters : Math.trunc(quarters);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
differenceInQuarters
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=chunk-KPB5ENNM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/differenceInQuarters.ts"],"sourcesContent":["import type { Temporal } from \"@js-temporal/polyfill\";\nimport { isPlainDate } from \"./shared/temporal\";\nimport { differenceInMonths } from \"./differenceInMonths\";\nimport type { DifferenceOptions } from \"./shared/differenceOptions\";\n\n/**\n * Returns the number of quarters (3-month blocks) between two datetimes or dates.\n * The result is positive if laterDate is after earlierDate, negative if before.\n *\n * Uses calendar-aware, elapsed-time calculation (a quarter is three months).\n * Instant inputs are converted to UTC; ZonedDateTime inputs keep their timezone.\n * PlainDate inputs are compared directly — no timezone needed.\n *\n * @param laterDate - The later Instant or ZonedDateTime\n * @param earlierDate - The earlier Instant or ZonedDateTime\n * @param options - Optional { fractional } to return the precise value\n * @returns The number of quarters, truncated toward zero (pass { fractional: true } for the precise value)\n *\n * @example\n * ```ts\n * const later = Temporal.Instant.from('2025-07-20T12:00:00Z');\n * const earlier = Temporal.Instant.from('2025-01-20T12:00:00Z');\n * differenceInQuarters(later, earlier); // 2\n * ```\n *\n * @example\n * ```ts\n * // PlainDate comparison needs no timezone\n * const later = Temporal.PlainDate.from('2025-07-20');\n * const earlier = Temporal.PlainDate.from('2025-01-20');\n * differenceInQuarters(later, earlier); // 2\n * ```\n */\nexport function differenceInQuarters(\n laterDate: Temporal.Instant | Temporal.ZonedDateTime,\n earlierDate: Temporal.Instant | Temporal.ZonedDateTime,\n options?: DifferenceOptions,\n): number;\nexport function differenceInQuarters(\n laterDate: Temporal.PlainDate,\n earlierDate: Temporal.PlainDate,\n options?: DifferenceOptions,\n): number;\nexport function differenceInQuarters(\n laterDate: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n earlierDate: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n options?: DifferenceOptions,\n): number {\n // A quarter is three months, so work in elapsed months and divide by 3.\n const months =\n isPlainDate(laterDate) && isPlainDate(earlierDate)\n ? earlierDate.until(laterDate).total({\n unit: \"months\",\n relativeTo: earlierDate,\n })\n : differenceInMonths(\n laterDate as Temporal.Instant | Temporal.ZonedDateTime,\n earlierDate as Temporal.Instant | Temporal.ZonedDateTime,\n { fractional: true },\n );\n\n const quarters = months / 3;\n return options?.fractional ? quarters : Math.trunc(quarters);\n}\n"],"mappings":";;;;;;;;AA2CO,SAAS,qBACd,WACA,aACA,SACQ;AAER,QAAM,SACJ,YAAY,SAAS,KAAK,YAAY,WAAW,IAC7C,YAAY,MAAM,SAAS,EAAE,MAAM;AAAA,IACjC,MAAM;AAAA,IACN,YAAY;AAAA,EACd,CAAC,IACD;AAAA,IACE;AAAA,IACA;AAAA,IACA,EAAE,YAAY,KAAK;AAAA,EACrB;AAEN,QAAM,WAAW,SAAS;AAC1B,SAAO,SAAS,aAAa,WAAW,KAAK,MAAM,QAAQ;AAC7D;","names":[]}
|
|
@@ -13,6 +13,9 @@ import {
|
|
|
13
13
|
|
|
14
14
|
// src/endOfWeek.ts
|
|
15
15
|
function endOfWeek(input, timezone) {
|
|
16
|
+
if (isPlainDate(input) && timezone === void 0) {
|
|
17
|
+
return input.add({ days: 7 - input.dayOfWeek });
|
|
18
|
+
}
|
|
16
19
|
const zonedDateTime = isPlainDate(input) ? plainDateToZonedDateTime(input, timezone) : normalizeTemporalInput(input);
|
|
17
20
|
const dayOfWeek = zonedDateTime.dayOfWeek;
|
|
18
21
|
const daysToAdd = 7 - dayOfWeek;
|
|
@@ -23,4 +26,4 @@ function endOfWeek(input, timezone) {
|
|
|
23
26
|
export {
|
|
24
27
|
endOfWeek
|
|
25
28
|
};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-MTDZG4HK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/endOfWeek.ts"],"sourcesContent":["import { isPlainDate } from './shared/temporal';\nimport type { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\nimport { getEndOfDay } from './shared/endOfDay';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { plainDateToZonedDateTime } from './shared/plainDateToZonedDateTime';\n\n/**\n * Returns the last boundary of the week (Sunday).\n * Uses ISO 8601 week definition: weeks end on Sunday.\n * PlainDate inputs stay in calendar space unless a timezone is provided.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at Sunday 23:59:59.999999999\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-01-20T12:00:00Z'); // Monday\n * const end = endOfWeek(instant);\n * // 2025-01-26T23:59:59.999999999Z[UTC] (next Sunday)\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 end = endOfWeek(zoned);\n * // 2025-01-26T23:59:59.999999999-05:00[America/New_York] (next Sunday)\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate (stays a date)\n * const date = Temporal.PlainDate.from('2025-01-22'); // Wednesday\n * const end = endOfWeek(date);\n * // 2025-01-26 (next Sunday)\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 end = endOfWeek(date, 'America/New_York');\n * // 2025-01-26T23:59:59.999999999-05:00[America/New_York] (next Sunday)\n * ```\n */\nexport function endOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime;\nexport function endOfWeek(input: Temporal.PlainDate): Temporal.PlainDate;\nexport function endOfWeek(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function endOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n if (isPlainDate(input) && timezone === undefined) {\n return input.add({ days: 7 - input.dayOfWeek });\n }\n\n const zonedDateTime =\n isPlainDate(input)\n ? plainDateToZonedDateTime(input, timezone!)\n : normalizeTemporalInput(input);\n\n // Get the day of week (1 = Monday, 7 = Sunday in ISO 8601)\n const dayOfWeek = zonedDateTime.dayOfWeek;\n\n // Calculate days to add to get to Sunday\n const daysToAdd = 7 - dayOfWeek;\n\n // Go to Sunday, then get end of that day\n const sunday = zonedDateTime.add({ days: daysToAdd });\n\n return getEndOfDay(sunday);\n}\n"],"mappings":";;;;;;;;;;;;;;AAuDO,SAAS,UACd,OACA,UAC6C;AAC7C,MAAI,YAAY,KAAK,KAAK,aAAa,QAAW;AAChD,WAAO,MAAM,IAAI,EAAE,MAAM,IAAI,MAAM,UAAU,CAAC;AAAA,EAChD;AAEA,QAAM,gBACJ,YAAY,KAAK,IACb,yBAAyB,OAAO,QAAS,IACzC,uBAAuB,KAAK;AAGlC,QAAM,YAAY,cAAc;AAGhC,QAAM,YAAY,IAAI;AAGtB,QAAM,SAAS,cAAc,IAAI,EAAE,MAAM,UAAU,CAAC;AAEpD,SAAO,YAAY,MAAM;AAC3B;","names":[]}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
quarterStartMonth
|
|
3
3
|
} from "./chunk-XS2HUADA.js";
|
|
4
|
+
import {
|
|
5
|
+
normalizeWithPlainDate
|
|
6
|
+
} from "./chunk-ZOHYNJUD.js";
|
|
4
7
|
import {
|
|
5
8
|
getEndOfDay
|
|
6
9
|
} from "./chunk-AVGNRINZ.js";
|
|
7
10
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
isPlainDate
|
|
12
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
10
13
|
|
|
11
14
|
// src/endOfQuarter.ts
|
|
12
15
|
function endOfQuarter(input, timezone) {
|
|
16
|
+
if (isPlainDate(input) && timezone === void 0) {
|
|
17
|
+
const endMonth2 = input.with({
|
|
18
|
+
month: quarterStartMonth(input.month) + 2,
|
|
19
|
+
day: 1
|
|
20
|
+
});
|
|
21
|
+
return endMonth2.with({ day: endMonth2.daysInMonth });
|
|
22
|
+
}
|
|
13
23
|
const zonedDateTime = normalizeWithPlainDate(input, timezone);
|
|
14
24
|
const endMonth = zonedDateTime.with({
|
|
15
25
|
month: quarterStartMonth(zonedDateTime.month) + 2,
|
|
@@ -22,4 +32,4 @@ function endOfQuarter(input, timezone) {
|
|
|
22
32
|
export {
|
|
23
33
|
endOfQuarter
|
|
24
34
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-OSBVYUOQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/endOfQuarter.ts"],"sourcesContent":["import { isPlainDate } from \"./shared/temporal\";\nimport type { Temporal } from \"@js-temporal/polyfill\";\nimport type { Timezone } from \"./types\";\nimport { getEndOfDay } from \"./shared/endOfDay\";\nimport { normalizeWithPlainDate } from \"./shared/normalizeWithPlainDate\";\nimport { quarterStartMonth } from \"./shared/quarter\";\n\n/**\n * Returns a ZonedDateTime representing the last moment of the quarter\n * (last day of the quarter's ending month at 23:59:59.999999999).\n *\n * Quarters: Q1 = Jan–Mar, Q2 = Apr–Jun, Q3 = Jul–Sep, Q4 = Oct–Dec.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at the last day of the quarter at 23:59:59.999999999\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-05-15T12:00:00Z');\n * const end = endOfQuarter(instant);\n * // 2025-06-30T23:59:59.999999999Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-02-15T15:30:00-05:00[America/New_York]');\n * const end = endOfQuarter(zoned);\n * // 2025-03-31T23:59:59.999999999-04:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate (requires timezone)\n * const date = Temporal.PlainDate.from('2025-11-15');\n * const end = endOfQuarter(date, 'America/New_York');\n * // 2025-12-31T23:59:59.999999999-05:00[America/New_York]\n * ```\n */\nexport function endOfQuarter(\n input: Temporal.Instant | Temporal.ZonedDateTime,\n): Temporal.ZonedDateTime;\nexport function endOfQuarter(input: Temporal.PlainDate): Temporal.PlainDate;\nexport function endOfQuarter(input: Temporal.PlainDate, timezone: Timezone): Temporal.ZonedDateTime;\nexport function endOfQuarter(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone,\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n // PlainDate with no timezone stays in calendar space → last day of quarter.\n if (isPlainDate(input) && timezone === undefined) {\n const endMonth = input.with({\n month: quarterStartMonth(input.month) + 2,\n day: 1,\n });\n return endMonth.with({ day: endMonth.daysInMonth });\n }\n const zonedDateTime = normalizeWithPlainDate(input, timezone!);\n const endMonth = zonedDateTime.with({\n month: quarterStartMonth(zonedDateTime.month) + 2,\n day: 1,\n });\n const lastDay = endMonth.with({ day: endMonth.daysInMonth });\n return getEndOfDay(lastDay);\n}\n"],"mappings":";;;;;;;;;;;;;;AA6CO,SAAS,aACd,OACA,UAC6C;AAE7C,MAAI,YAAY,KAAK,KAAK,aAAa,QAAW;AAChD,UAAMA,YAAW,MAAM,KAAK;AAAA,MAC1B,OAAO,kBAAkB,MAAM,KAAK,IAAI;AAAA,MACxC,KAAK;AAAA,IACP,CAAC;AACD,WAAOA,UAAS,KAAK,EAAE,KAAKA,UAAS,YAAY,CAAC;AAAA,EACpD;AACA,QAAM,gBAAgB,uBAAuB,OAAO,QAAS;AAC7D,QAAM,WAAW,cAAc,KAAK;AAAA,IAClC,OAAO,kBAAkB,cAAc,KAAK,IAAI;AAAA,IAChD,KAAK;AAAA,EACP,CAAC;AACD,QAAM,UAAU,SAAS,KAAK,EAAE,KAAK,SAAS,YAAY,CAAC;AAC3D,SAAO,YAAY,OAAO;AAC5B;","names":["endMonth"]}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeWithPlainDate
|
|
3
3
|
} from "./chunk-ZOHYNJUD.js";
|
|
4
|
+
import {
|
|
5
|
+
isPlainDate
|
|
6
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
4
7
|
|
|
5
8
|
// src/startOfYear.ts
|
|
6
9
|
function startOfYear(input, timezone) {
|
|
10
|
+
if (isPlainDate(input) && timezone === void 0) {
|
|
11
|
+
return input.with({ month: 1, day: 1 });
|
|
12
|
+
}
|
|
7
13
|
const zonedDateTime = normalizeWithPlainDate(input, timezone);
|
|
8
14
|
const firstDay = zonedDateTime.with({ month: 1, day: 1 });
|
|
9
15
|
return firstDay.startOfDay();
|
|
@@ -12,4 +18,4 @@ function startOfYear(input, timezone) {
|
|
|
12
18
|
export {
|
|
13
19
|
startOfYear
|
|
14
20
|
};
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-OVSCDXYN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/startOfYear.ts"],"sourcesContent":["import { isPlainDate, Temporal } from './shared/temporal';\nimport type { Timezone } from './types';\nimport { normalizeWithPlainDate } from './shared/normalizeWithPlainDate';\n\n/**\n * Returns the first boundary of the year.\n * PlainDate inputs stay in calendar space unless a timezone is provided.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at January 1st at 00:00:00.000000000\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-06-15T12:00:00Z');\n * const start = startOfYear(instant);\n * // 2025-01-01T00:00:00Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-06-15T15:30:00-05:00[America/New_York]');\n * const start = startOfYear(zoned);\n * // 2025-01-01T00:00:00-05:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate (stays a date)\n * const date = Temporal.PlainDate.from('2025-06-15');\n * const start = startOfYear(date);\n * // 2025-01-01\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate with a timezone (returns a ZonedDateTime)\n * const date = Temporal.PlainDate.from('2025-06-15');\n * const start = startOfYear(date, 'America/New_York');\n * // 2025-01-01T00:00:00-05:00[America/New_York]\n * ```\n */\nexport function startOfYear(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime;\nexport function startOfYear(input: Temporal.PlainDate): Temporal.PlainDate;\nexport function startOfYear(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function startOfYear(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n if (isPlainDate(input) && timezone === undefined) {\n return input.with({ month: 1, day: 1 });\n }\n\n const zonedDateTime = normalizeWithPlainDate(input, timezone!);\n const firstDay = zonedDateTime.with({ month: 1, day: 1 });\n return firstDay.startOfDay();\n}\n"],"mappings":";;;;;;;;AAmDO,SAAS,YACd,OACA,UAC6C;AAC7C,MAAI,YAAY,KAAK,KAAK,aAAa,QAAW;AAChD,WAAO,MAAM,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE,CAAC;AAAA,EACxC;AAEA,QAAM,gBAAgB,uBAAuB,OAAO,QAAS;AAC7D,QAAM,WAAW,cAAc,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE,CAAC;AACxD,SAAO,SAAS,WAAW;AAC7B;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getEndOfDay
|
|
3
|
-
} from "./chunk-AVGNRINZ.js";
|
|
4
1
|
import {
|
|
5
2
|
normalizeWithPlainDate
|
|
6
3
|
} from "./chunk-ZOHYNJUD.js";
|
|
4
|
+
import {
|
|
5
|
+
getEndOfDay
|
|
6
|
+
} from "./chunk-AVGNRINZ.js";
|
|
7
7
|
|
|
8
8
|
// src/endOfDay.ts
|
|
9
9
|
function endOfDay(input, timezone) {
|
|
@@ -14,4 +14,4 @@ function endOfDay(input, timezone) {
|
|
|
14
14
|
export {
|
|
15
15
|
endOfDay
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-S7L5KBI4.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeTemporalInput
|
|
3
|
+
} from "./chunk-NTMT5XGC.js";
|
|
4
|
+
import {
|
|
5
|
+
isPlainDate
|
|
6
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
7
|
+
|
|
8
|
+
// src/addQuarters.ts
|
|
9
|
+
function addQuarters(input, quarters) {
|
|
10
|
+
if (isPlainDate(input)) {
|
|
11
|
+
return input.add({ months: quarters * 3 });
|
|
12
|
+
}
|
|
13
|
+
return normalizeTemporalInput(input).add({ months: quarters * 3 });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
addQuarters
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=chunk-UQ2F3I2S.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/addQuarters.ts"],"sourcesContent":["import type { Temporal } from \"@js-temporal/polyfill\";\nimport { isPlainDate } from \"./shared/temporal\";\nimport { normalizeTemporalInput } from \"./shared/normalizeTemporalInput\";\n\n/**\n * Adds the specified number of quarters (3-month blocks) to a datetime or date.\n *\n * Properly handles month-end dates and calendar edge cases through Temporal API.\n * Instant inputs are converted to UTC; ZonedDateTime inputs preserve their\n * timezone. PlainDate inputs stay in calendar space and return a PlainDate.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @param quarters - Number of quarters to add (can be negative to subtract)\n * @returns A ZonedDateTime (for Instant/ZonedDateTime) with the quarters added\n *\n * @example\n * ```ts\n * const instant = Temporal.Instant.from('2025-01-20T12:00:00Z');\n * addQuarters(instant, 2);\n * // 2025-07-20T12:00:00Z[UTC] (6 months later)\n * ```\n *\n * @example\n * ```ts\n * // Calendar arithmetic on a date stays a date\n * addQuarters(Temporal.PlainDate.from('2025-01-31'), 1);\n * // 2025-04-30 (Jan 31 → Apr 30)\n * ```\n */\nexport function addQuarters(\n input: Temporal.Instant | Temporal.ZonedDateTime,\n quarters: number,\n): Temporal.ZonedDateTime;\nexport function addQuarters(input: Temporal.PlainDate, quarters: number): Temporal.PlainDate;\nexport function addQuarters(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n quarters: number,\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n if (isPlainDate(input)) {\n return input.add({ months: quarters * 3 });\n }\n return normalizeTemporalInput(input).add({ months: quarters * 3 });\n}\n"],"mappings":";;;;;;;;AAkCO,SAAS,YACd,OACA,UAC6C;AAC7C,MAAI,YAAY,KAAK,GAAG;AACtB,WAAO,MAAM,IAAI,EAAE,QAAQ,WAAW,EAAE,CAAC;AAAA,EAC3C;AACA,SAAO,uBAAuB,KAAK,EAAE,IAAI,EAAE,QAAQ,WAAW,EAAE,CAAC;AACnE;","names":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Temporal
|
|
2
|
+
Temporal,
|
|
3
|
+
isInstant
|
|
3
4
|
} from "./chunk-R7ZCA6AQ.js";
|
|
4
5
|
|
|
5
|
-
// src/
|
|
6
|
-
function
|
|
6
|
+
// src/toInstant.ts
|
|
7
|
+
function toInstant(input) {
|
|
7
8
|
if (typeof input === "string") {
|
|
8
9
|
return Temporal.Instant.from(input);
|
|
9
10
|
}
|
|
@@ -13,10 +14,10 @@ function toUtc(input) {
|
|
|
13
14
|
if (input instanceof Date) {
|
|
14
15
|
return Temporal.Instant.from(input.toISOString());
|
|
15
16
|
}
|
|
16
|
-
return input.toInstant();
|
|
17
|
+
return isInstant(input) ? input : input.toInstant();
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
toInstant
|
|
21
22
|
};
|
|
22
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-VQAGV72H.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/toInstant.ts"],"sourcesContent":["import { Temporal, isInstant } from './shared/temporal';\n\n/**\n * Converts a timeline representation to a Temporal.Instant.\n *\n * Instant inputs are returned unchanged. ZonedDateTime inputs preserve their\n * exact moment while dropping timezone and calendar context.\n *\n * @param input - An Instant, ZonedDateTime, UTC ISO string, Unix timestamp, or Date\n * @returns A timezone-independent Temporal.Instant\n *\n * @example\n * ```typescript\n * const instant = toInstant('2025-01-20T20:00:00Z');\n * // 2025-01-20T20:00:00Z\n * ```\n *\n * @example\n * ```typescript\n * const zoned = Temporal.ZonedDateTime.from(\n * '2025-01-20T15:00:00-05:00[America/New_York]'\n * );\n * const instant = toInstant(zoned);\n * // 2025-01-20T20:00:00Z\n * ```\n */\nexport function toInstant(\n input: string | number | Date | Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.Instant {\n if (typeof input === 'string') {\n return Temporal.Instant.from(input);\n }\n\n if (typeof input === 'number') {\n return Temporal.Instant.fromEpochMilliseconds(input);\n }\n\n if (input instanceof Date) {\n return Temporal.Instant.from(input.toISOString());\n }\n\n return isInstant(input) ? input : input.toInstant();\n}\n"],"mappings":";;;;;;AA0BO,SAAS,UACd,OACkB;AAClB,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,SAAS,QAAQ,KAAK,KAAK;AAAA,EACpC;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,SAAS,QAAQ,sBAAsB,KAAK;AAAA,EACrD;AAEA,MAAI,iBAAiB,MAAM;AACzB,WAAO,SAAS,QAAQ,KAAK,MAAM,YAAY,CAAC;AAAA,EAClD;AAEA,SAAO,UAAU,KAAK,IAAI,QAAQ,MAAM,UAAU;AACpD;","names":[]}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeWithPlainDate
|
|
3
|
+
} from "./chunk-ZOHYNJUD.js";
|
|
1
4
|
import {
|
|
2
5
|
getEndOfDay
|
|
3
6
|
} from "./chunk-AVGNRINZ.js";
|
|
4
7
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
8
|
+
isPlainDate
|
|
9
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
7
10
|
|
|
8
11
|
// src/endOfMonth.ts
|
|
9
12
|
function endOfMonth(input, timezone) {
|
|
13
|
+
if (isPlainDate(input) && timezone === void 0) {
|
|
14
|
+
return input.with({ day: input.daysInMonth });
|
|
15
|
+
}
|
|
10
16
|
const zonedDateTime = normalizeWithPlainDate(input, timezone);
|
|
11
17
|
const lastDay = zonedDateTime.with({ day: zonedDateTime.daysInMonth });
|
|
12
18
|
return getEndOfDay(lastDay);
|
|
@@ -15,4 +21,4 @@ function endOfMonth(input, timezone) {
|
|
|
15
21
|
export {
|
|
16
22
|
endOfMonth
|
|
17
23
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-YNLBS34B.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/endOfMonth.ts"],"sourcesContent":["import { isPlainDate, Temporal } from './shared/temporal';\nimport type { Timezone } from './types';\nimport { getEndOfDay } from './shared/endOfDay';\nimport { normalizeWithPlainDate } from './shared/normalizeWithPlainDate';\n\n/**\n * Returns the last boundary of the month.\n * PlainDate inputs stay in calendar space unless a timezone is provided.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at the last day of the month at 23:59:59.999999999\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-01-15T12:00:00Z');\n * const end = endOfMonth(instant);\n * // 2025-01-31T23:59:59.999999999Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-02-15T15:30:00-05:00[America/New_York]');\n * const end = endOfMonth(zoned);\n * // 2025-02-28T23:59:59.999999999-05:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate (stays a date)\n * const date = Temporal.PlainDate.from('2025-02-15');\n * const end = endOfMonth(date);\n * // 2025-02-28\n * ```\n *\n * @example\n * ```ts\n * // From PlainDate with a timezone (returns a ZonedDateTime)\n * const date = Temporal.PlainDate.from('2025-02-15');\n * const end = endOfMonth(date, 'America/New_York');\n * // 2025-02-28T23:59:59.999999999-05:00[America/New_York]\n * ```\n */\nexport function endOfMonth(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime;\nexport function endOfMonth(input: Temporal.PlainDate): Temporal.PlainDate;\nexport function endOfMonth(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function endOfMonth(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime | Temporal.PlainDate {\n if (isPlainDate(input) && timezone === undefined) {\n return input.with({ day: input.daysInMonth });\n }\n\n const zonedDateTime = normalizeWithPlainDate(input, timezone!);\n const lastDay = zonedDateTime.with({ day: zonedDateTime.daysInMonth });\n return getEndOfDay(lastDay);\n}\n"],"mappings":";;;;;;;;;;;AAoDO,SAAS,WACd,OACA,UAC6C;AAC7C,MAAI,YAAY,KAAK,KAAK,aAAa,QAAW;AAChD,WAAO,MAAM,KAAK,EAAE,KAAK,MAAM,YAAY,CAAC;AAAA,EAC9C;AAEA,QAAM,gBAAgB,uBAAuB,OAAO,QAAS;AAC7D,QAAM,UAAU,cAAc,KAAK,EAAE,KAAK,cAAc,YAAY,CAAC;AACrE,SAAO,YAAY,OAAO;AAC5B;","names":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
quarterStartMonth
|
|
3
|
+
} from "./chunk-XS2HUADA.js";
|
|
4
|
+
import {
|
|
5
|
+
normalizeTemporalInput
|
|
6
|
+
} from "./chunk-NTMT5XGC.js";
|
|
7
|
+
import {
|
|
8
|
+
Temporal,
|
|
9
|
+
isPlainDate
|
|
10
|
+
} from "./chunk-R7ZCA6AQ.js";
|
|
11
|
+
|
|
12
|
+
// src/eachQuarterOfInterval.ts
|
|
13
|
+
function eachQuarterOfInterval(interval) {
|
|
14
|
+
if (isPlainDate(interval.start) && isPlainDate(interval.end)) {
|
|
15
|
+
return eachQuarterStart(interval.start, interval.end, (ym) => ym.toPlainDate({ day: 1 }));
|
|
16
|
+
}
|
|
17
|
+
const startZoned = normalizeTemporalInput(
|
|
18
|
+
interval.start
|
|
19
|
+
);
|
|
20
|
+
const endZoned = normalizeTemporalInput(
|
|
21
|
+
interval.end
|
|
22
|
+
);
|
|
23
|
+
const timezone = startZoned.timeZoneId;
|
|
24
|
+
return eachQuarterStart(
|
|
25
|
+
startZoned,
|
|
26
|
+
endZoned.withTimeZone(timezone),
|
|
27
|
+
(ym) => ym.toPlainDate({ day: 1 }).toZonedDateTime({
|
|
28
|
+
timeZone: timezone,
|
|
29
|
+
plainTime: new Temporal.PlainTime()
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function eachQuarterStart(start, end, make) {
|
|
34
|
+
const startYearMonth = Temporal.PlainYearMonth.from({
|
|
35
|
+
year: start.year,
|
|
36
|
+
month: quarterStartMonth(start.month)
|
|
37
|
+
});
|
|
38
|
+
const endYearMonth = Temporal.PlainYearMonth.from({
|
|
39
|
+
year: end.year,
|
|
40
|
+
month: quarterStartMonth(end.month)
|
|
41
|
+
});
|
|
42
|
+
const out = [];
|
|
43
|
+
let current = startYearMonth;
|
|
44
|
+
while (Temporal.PlainYearMonth.compare(current, endYearMonth) <= 0) {
|
|
45
|
+
out.push(make(current));
|
|
46
|
+
current = current.add({ months: 3 });
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
eachQuarterOfInterval
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=chunk-YRCFMGBH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/eachQuarterOfInterval.ts"],"sourcesContent":["import { Temporal } from \"./shared/temporal\";\nimport { isPlainDate } from \"./shared/temporal\";\nimport { normalizeTemporalInput } from \"./shared/normalizeTemporalInput\";\nimport { quarterStartMonth } from \"./shared/quarter\";\n\n/**\n * Returns an array with the start of each quarter within the interval, inclusive\n * of both the start and end quarters.\n *\n * Quarters: Q1 = Jan–Mar, Q2 = Apr–Jun, Q3 = Jul–Sep, Q4 = Oct–Dec. Each element\n * is the first moment of the quarter (1st day of the quarter's starting month at\n * midnight) for Instant/ZonedDateTime inputs, or the first day as a PlainDate for\n * PlainDate inputs.\n *\n * For Instant inputs, UTC is used. For ZonedDateTime inputs, the timezone of the\n * start date is preserved. PlainDate inputs need no timezone and return PlainDate[].\n *\n * @param interval - The interval with start and end\n * @returns Array of ZonedDateTime (or PlainDate) at the start of each quarter\n *\n * @example\n * ```ts\n * const start = Temporal.ZonedDateTime.from('2025-02-15T10:00:00Z[UTC]');\n * const end = Temporal.ZonedDateTime.from('2025-11-20T14:00:00Z[UTC]');\n * eachQuarterOfInterval({ start, end });\n * // [2025-01-01…, 2025-04-01…, 2025-07-01…, 2025-10-01…]\n * ```\n *\n * @example\n * ```ts\n * // PlainDate interval returns PlainDate quarter starts (no timezone)\n * eachQuarterOfInterval({\n * start: Temporal.PlainDate.from('2025-02-15'),\n * end: Temporal.PlainDate.from('2025-08-20'),\n * });\n * // [2025-01-01, 2025-04-01, 2025-07-01]\n * ```\n */\nexport function eachQuarterOfInterval(interval: {\n start: Temporal.Instant | Temporal.ZonedDateTime;\n end: Temporal.Instant | Temporal.ZonedDateTime;\n}): Temporal.ZonedDateTime[];\nexport function eachQuarterOfInterval(interval: {\n start: Temporal.PlainDate;\n end: Temporal.PlainDate;\n}): Temporal.PlainDate[];\nexport function eachQuarterOfInterval(interval: {\n start: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate;\n end: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate;\n}): Temporal.ZonedDateTime[] | Temporal.PlainDate[] {\n if (isPlainDate(interval.start) && isPlainDate(interval.end)) {\n return eachQuarterStart(interval.start, interval.end, (ym) => ym.toPlainDate({ day: 1 }));\n }\n\n const startZoned = normalizeTemporalInput(\n interval.start as Temporal.Instant | Temporal.ZonedDateTime,\n );\n const endZoned = normalizeTemporalInput(\n interval.end as Temporal.Instant | Temporal.ZonedDateTime,\n );\n const timezone = startZoned.timeZoneId;\n\n return eachQuarterStart(startZoned, endZoned.withTimeZone(timezone), (ym) =>\n ym.toPlainDate({ day: 1 }).toZonedDateTime({\n timeZone: timezone,\n plainTime: new Temporal.PlainTime(),\n }),\n );\n}\n\n/**\n * Walks quarter-aligned year-months from start to end (inclusive) and maps each\n * to a result. Both bounds are snapped to their quarter's starting month.\n */\nfunction eachQuarterStart<T>(\n start: { year: number; month: number },\n end: { year: number; month: number },\n make: (ym: Temporal.PlainYearMonth) => T,\n): T[] {\n const startYearMonth = Temporal.PlainYearMonth.from({\n year: start.year,\n month: quarterStartMonth(start.month),\n });\n const endYearMonth = Temporal.PlainYearMonth.from({\n year: end.year,\n month: quarterStartMonth(end.month),\n });\n\n const out: T[] = [];\n let current = startYearMonth;\n while (Temporal.PlainYearMonth.compare(current, endYearMonth) <= 0) {\n out.push(make(current));\n current = current.add({ months: 3 });\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;AA8CO,SAAS,sBAAsB,UAGc;AAClD,MAAI,YAAY,SAAS,KAAK,KAAK,YAAY,SAAS,GAAG,GAAG;AAC5D,WAAO,iBAAiB,SAAS,OAAO,SAAS,KAAK,CAAC,OAAO,GAAG,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;AAAA,EAC1F;AAEA,QAAM,aAAa;AAAA,IACjB,SAAS;AAAA,EACX;AACA,QAAM,WAAW;AAAA,IACf,SAAS;AAAA,EACX;AACA,QAAM,WAAW,WAAW;AAE5B,SAAO;AAAA,IAAiB;AAAA,IAAY,SAAS,aAAa,QAAQ;AAAA,IAAG,CAAC,OACpE,GAAG,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,gBAAgB;AAAA,MACzC,UAAU;AAAA,MACV,WAAW,IAAI,SAAS,UAAU;AAAA,IACpC,CAAC;AAAA,EACH;AACF;AAMA,SAAS,iBACP,OACA,KACA,MACK;AACL,QAAM,iBAAiB,SAAS,eAAe,KAAK;AAAA,IAClD,MAAM,MAAM;AAAA,IACZ,OAAO,kBAAkB,MAAM,KAAK;AAAA,EACtC,CAAC;AACD,QAAM,eAAe,SAAS,eAAe,KAAK;AAAA,IAChD,MAAM,IAAI;AAAA,IACV,OAAO,kBAAkB,IAAI,KAAK;AAAA,EACpC,CAAC;AAED,QAAM,MAAW,CAAC;AAClB,MAAI,UAAU;AACd,SAAO,SAAS,eAAe,QAAQ,SAAS,YAAY,KAAK,GAAG;AAClE,QAAI,KAAK,KAAK,OAAO,CAAC;AACtB,cAAU,QAAQ,IAAI,EAAE,QAAQ,EAAE,CAAC;AAAA,EACrC;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Temporal } from './shared/temporal';
|
|
2
|
-
import type { DifferenceOptions } from './shared/differenceOptions';
|
|
1
|
+
import { Temporal } from './shared/temporal.js';
|
|
2
|
+
import type { DifferenceOptions } from './shared/differenceOptions.js';
|
|
3
3
|
/**
|
|
4
4
|
* Returns the number of days between two datetimes.
|
|
5
5
|
* The result is positive if laterDate is after earlierDate, negative if before.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Temporal } from './shared/temporal';
|
|
2
|
-
import type { DifferenceOptions } from './shared/differenceOptions';
|
|
1
|
+
import { Temporal } from './shared/temporal.js';
|
|
2
|
+
import type { DifferenceOptions } from './shared/differenceOptions.js';
|
|
3
3
|
/**
|
|
4
4
|
* Returns the number of hours between two datetimes.
|
|
5
5
|
* The result is positive if laterDate is after earlierDate, negative if before.
|