@northguild/gmt 1.19.0 → 1.20.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/README.md +12 -12
- package/dist/calendar/business/businessDaysBetween.d.ts +2 -2
- package/dist/calendar/business/businessDaysBetween.js +11 -35
- package/dist/calendar/business/mergeCalendars.d.ts +1 -1
- package/dist/calendar/business/mergeCalendars.js +8 -9
- package/dist/calendar/business/nextBusinessDay.d.ts +2 -2
- package/dist/calendar/business/nextBusinessDay.js +2 -2
- package/dist/calendar/business/previousBusinessDay.d.ts +2 -2
- package/dist/calendar/business/previousBusinessDay.js +2 -2
- package/dist/calendar/business/rollDate.d.ts +3 -3
- package/dist/calendar/business/rollDate.js +10 -43
- package/dist/calendar/calculate/bucketRange.d.ts +9 -9
- package/dist/calendar/calculate/bucketRange.js +9 -9
- package/dist/calendar/calculate/floorToZone.d.ts +2 -2
- package/dist/calendar/calculate/floorToZone.js +1 -1
- package/dist/calendar/calculate/getFiscalPeriod.d.ts +50 -40
- package/dist/calendar/calculate/getFiscalPeriod.js +78 -57
- package/dist/calendar/calculate/getQuarter.d.ts +26 -21
- package/dist/calendar/calculate/getQuarter.js +48 -19
- package/dist/calendar/hours/addOperatingTime.d.ts +3 -3
- package/dist/calendar/hours/addOperatingTime.js +3 -3
- package/dist/calendar/hours/isOpenAt.d.ts +3 -3
- package/dist/calendar/hours/isOpenAt.js +3 -3
- package/dist/calendar/hours/nextCloseAt.d.ts +2 -2
- package/dist/calendar/hours/nextCloseAt.js +2 -2
- package/dist/calendar/hours/nextOpenAt.d.ts +3 -3
- package/dist/calendar/hours/nextOpenAt.js +3 -3
- package/dist/calendar/hours/operatingIntervals.d.ts +2 -2
- package/dist/calendar/hours/operatingIntervals.js +4 -6
- package/dist/calendar/hours/operatingTimeBetween.d.ts +3 -3
- package/dist/calendar/hours/operatingTimeBetween.js +6 -8
- package/dist/calendar/hours/recurringWindows.d.ts +5 -5
- package/dist/calendar/hours/recurringWindows.js +9 -10
- package/dist/calendar/index.d.ts +1 -1
- package/dist/calendar/index.js +2 -2
- package/dist/calendar/validate/index.d.ts +3 -0
- package/dist/calendar/validate/index.js +3 -0
- package/dist/calendar/validate/isValidFiscalCalendar.d.ts +23 -0
- package/dist/calendar/validate/isValidFiscalCalendar.js +44 -0
- package/dist/calendar/validate/isValidFiscalExtraWeek.d.ts +19 -0
- package/dist/calendar/validate/isValidFiscalExtraWeek.js +23 -0
- package/dist/calendar/validate/isValidFiscalPattern.d.ts +7 -7
- package/dist/calendar/validate/isValidFiscalPattern.js +7 -7
- package/dist/calendar/validate/isValidFiscalYearLabel.d.ts +20 -0
- package/dist/calendar/validate/isValidFiscalYearLabel.js +24 -0
- package/dist/calendar/validate/isValidRollConvention.js +2 -10
- package/dist/calendar/validate/isValidZoneBucketUnit.d.ts +1 -1
- package/dist/duration/calculate/absDuration.js +1 -1
- package/dist/duration/calculate/addDuration.js +1 -1
- package/dist/duration/calculate/durationFromUnits.js +1 -1
- package/dist/duration/calculate/getDurationSign.js +1 -1
- package/dist/duration/calculate/getDurationUnit.d.ts +1 -1
- package/dist/duration/calculate/getDurationUnit.js +1 -1
- package/dist/duration/calculate/negateDuration.js +1 -1
- package/dist/duration/calculate/subtractDuration.js +1 -1
- package/dist/duration/calculate/totalDuration.d.ts +4 -4
- package/dist/duration/calculate/totalDuration.js +4 -4
- package/dist/duration/calculate/totalUnits.js +1 -1
- package/dist/duration/compare/compareDurations.d.ts +3 -3
- package/dist/duration/compare/compareDurations.js +3 -3
- package/dist/duration/format/formatDuration.d.ts +9 -9
- package/dist/duration/format/formatDuration.js +14 -13
- package/dist/duration/index.d.ts +1 -1
- package/dist/duration/index.js +2 -2
- package/dist/duration/normalize/normalizeDuration.d.ts +3 -3
- package/dist/duration/normalize/normalizeDuration.js +3 -3
- package/dist/duration/parse/parseDuration.d.ts +1 -1
- package/dist/duration/parse/parseDuration.js +1 -1
- package/dist/duration/validate/isValidDuration.js +2 -11
- package/dist/gnss/convert/gnssToUtc.d.ts +24 -0
- package/dist/gnss/convert/gnssToUtc.js +39 -0
- package/dist/gnss/convert/gnssWeekToUtc.d.ts +53 -0
- package/dist/gnss/convert/gnssWeekToUtc.js +80 -0
- package/dist/gnss/convert/index.d.ts +6 -0
- package/dist/gnss/convert/index.js +6 -0
- package/dist/gnss/convert/rinexWeekToUtc.d.ts +34 -0
- package/dist/gnss/convert/rinexWeekToUtc.js +57 -0
- package/dist/gnss/convert/utcToGnss.d.ts +38 -0
- package/dist/gnss/convert/utcToGnss.js +53 -0
- package/dist/gnss/convert/utcToGnssWeek.d.ts +24 -0
- package/dist/gnss/convert/utcToGnssWeek.js +40 -0
- package/dist/gnss/convert/utcToRinexWeek.d.ts +19 -0
- package/dist/gnss/convert/utcToRinexWeek.js +45 -0
- package/dist/gnss/index.d.ts +2 -0
- package/dist/gnss/index.js +3 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/instant/convert/classifyLocal.d.ts +4 -4
- package/dist/instant/convert/classifyLocal.js +8 -19
- package/dist/instant/convert/fromOffsetInstant.d.ts +4 -4
- package/dist/instant/convert/fromOffsetInstant.js +5 -5
- package/dist/instant/convert/resolveLocal.d.ts +9 -9
- package/dist/instant/convert/resolveLocal.js +9 -9
- package/dist/instant/convert/toOffsetInstant.d.ts +11 -11
- package/dist/instant/convert/toOffsetInstant.js +11 -28
- package/dist/instant/index.d.ts +1 -1
- package/dist/instant/index.js +2 -2
- package/dist/instant/validate/isValidUtcOffset.d.ts +1 -1
- package/dist/instant/validate/isValidUtcOffset.js +1 -1
- package/dist/intermodal/calculate/billingTimeline.js +1 -1
- package/dist/intermodal/calculate/chargeableDays.d.ts +12 -12
- package/dist/intermodal/calculate/chargeableDays.js +17 -16
- package/dist/intermodal/calculate/demurrageClock.d.ts +1 -1
- package/dist/intermodal/calculate/demurrageClock.js +2 -2
- package/dist/intermodal/calculate/freeTimeExpiry.d.ts +10 -10
- package/dist/intermodal/calculate/freeTimeExpiry.js +19 -15
- package/dist/intermodal/calculate/multimodalETA.d.ts +1 -1
- package/dist/intermodal/calculate/multimodalETA.js +2 -2
- package/dist/intermodal/format/bolTimestamp.d.ts +6 -6
- package/dist/intermodal/format/bolTimestamp.js +6 -6
- package/dist/intermodal/format/formatEpcisEvent.d.ts +1 -1
- package/dist/intermodal/format/formatEpcisEvent.js +2 -2
- package/dist/intermodal/index.d.ts +1 -1
- package/dist/intermodal/index.js +2 -2
- package/dist/intermodal/parse/parseEpcisEvent.js +1 -1
- package/dist/intermodal/validate/isValidEpcisEventTime.js +1 -1
- package/dist/internal/advanceToWeekday.d.ts +1 -1
- package/dist/internal/businessCalendar.d.ts +28 -12
- package/dist/internal/businessCalendar.js +129 -118
- package/dist/internal/businessDayValues.js +1 -1
- package/dist/internal/calendarDatePairPolicy.d.ts +1 -1
- package/dist/internal/calendarDateString.d.ts +1 -1
- package/dist/internal/calendarDateString.js +1 -1
- package/dist/internal/calendarSystemIds.js +1 -1
- package/dist/internal/calendarValueOfDate.js +1 -1
- package/dist/internal/calendarZonedPairPolicy.d.ts +1 -1
- package/dist/internal/calendarZonedString.d.ts +3 -3
- package/dist/internal/calendarZonedString.js +4 -4
- package/dist/internal/compareUnixEpochs.js +1 -1
- package/dist/internal/cutoffAtResolved.d.ts +62 -0
- package/dist/internal/cutoffAtResolved.js +162 -0
- package/dist/internal/cycleFieldValue.d.ts +0 -2
- package/dist/internal/cycleFieldValue.js +0 -2
- package/dist/internal/dateTimeUnitHelpers.d.ts +1 -1
- package/dist/internal/dateUnitHelpers.d.ts +1 -1
- package/dist/internal/daylightTime.d.ts +1 -1
- package/dist/internal/differenceRecord.d.ts +1 -1
- package/dist/internal/durationUntilString.d.ts +1 -1
- package/dist/internal/durationUntilString.js +1 -1
- package/dist/internal/dutyEngine.d.ts +6 -6
- package/dist/internal/dutyEngine.js +206 -197
- package/dist/internal/dutyPeriods.d.ts +1 -1
- package/dist/internal/dutyPeriods.js +8 -2
- package/dist/internal/dutyRules.d.ts +2 -1
- package/dist/internal/dutyRules.js +1 -1
- package/dist/internal/dutyRunIndex.d.ts +150 -0
- package/dist/internal/dutyRunIndex.js +398 -0
- package/dist/internal/earlierOccurrence.d.ts +41 -0
- package/dist/internal/earlierOccurrence.js +57 -0
- package/dist/internal/ediDateTimeFields.js +1 -1
- package/dist/internal/ediDateTimeWriter.js +1 -1
- package/dist/internal/englishCalendarNames.d.ts +1 -1
- package/dist/internal/epochDay.d.ts +41 -0
- package/dist/internal/epochDay.js +129 -0
- package/dist/internal/exactDuration.js +1 -1
- package/dist/internal/exactMoment.d.ts +4 -4
- package/dist/internal/exactMoment.js +5 -5
- package/dist/internal/fiscalCalendar.d.ts +41 -7
- package/dist/internal/fiscalCalendar.js +77 -9
- package/dist/internal/foreignEpochs.d.ts +5 -0
- package/dist/internal/foreignEpochs.js +5 -0
- package/dist/internal/formatCalendarDays.d.ts +4 -4
- package/dist/internal/formatCalendarDays.js +6 -5
- package/dist/internal/formatDateInCalendar.d.ts +1 -1
- package/dist/internal/formatRelativeDuration.d.ts +7 -7
- package/dist/internal/formatRelativeDuration.js +8 -7
- package/dist/internal/formatterCache.d.ts +40 -0
- package/dist/internal/formatterCache.js +181 -0
- package/dist/internal/freeTimeLedger.d.ts +31 -43
- package/dist/internal/freeTimeLedger.js +322 -30
- package/dist/internal/getLocaleWeekYearBounds.d.ts +1 -1
- package/dist/internal/gnssTimeScales.d.ts +53 -0
- package/dist/internal/gnssTimeScales.js +128 -0
- package/dist/internal/gnssWeek.d.ts +92 -0
- package/dist/internal/gnssWeek.js +212 -0
- package/dist/internal/halfOpenIntervals.d.ts +1 -1
- package/dist/internal/halfOpenIntervals.js +1 -1
- package/dist/internal/hasCalendarAnnotation.d.ts +3 -3
- package/dist/internal/hasCalendarAnnotation.js +3 -3
- package/dist/internal/hourDurationString.js +1 -1
- package/dist/internal/httpDateFields.js +1 -1
- package/dist/internal/index.d.ts +9 -3
- package/dist/internal/index.js +9 -3
- package/dist/internal/inputChecks.d.ts +53 -0
- package/dist/internal/inputChecks.js +132 -0
- package/dist/internal/instantFormatOptions.d.ts +1 -1
- package/dist/internal/instantFormatOptions.js +4 -8
- package/dist/internal/instantIntervalText.js +1 -1
- package/dist/internal/instantNanoseconds.d.ts +2 -2
- package/dist/internal/instantNanoseconds.js +2 -2
- package/dist/internal/intervalCountHelpers.d.ts +1 -1
- package/dist/internal/isoStringBody.d.ts +2 -2
- package/dist/internal/isoStringBody.js +2 -2
- package/dist/internal/joinDateTimeConnector.js +3 -2
- package/dist/internal/leapSeconds.d.ts +63 -0
- package/dist/internal/leapSeconds.js +162 -0
- package/dist/internal/localeWeekInfo.d.ts +1 -1
- package/dist/internal/localeWeekInfo.js +1 -1
- package/dist/internal/monthGridWeekRow.d.ts +1 -1
- package/dist/internal/normalizeDateTime.d.ts +2 -1
- package/dist/internal/normalizeDateTime.js +3 -2
- package/dist/internal/normalizeTimeZone.d.ts +1 -1
- package/dist/internal/normalizeTimeZone.js +1 -1
- package/dist/internal/offsetTimeline.d.ts +56 -0
- package/dist/internal/offsetTimeline.js +166 -0
- package/dist/internal/operatingSchedule.d.ts +28 -32
- package/dist/internal/operatingSchedule.js +538 -176
- package/dist/internal/patternToken.js +10 -7
- package/dist/internal/plainDateAdd.d.ts +1 -1
- package/dist/internal/plainDateAdd.js +1 -1
- package/dist/internal/plainDateUntil.d.ts +1 -1
- package/dist/internal/plainDateUntil.js +1 -1
- package/dist/internal/readSetFields.js +1 -1
- package/dist/internal/resolveDurationRelativeTo.d.ts +1 -1
- package/dist/internal/resolveDurationRelativeTo.js +1 -1
- package/dist/internal/resolveLocale.d.ts +2 -2
- package/dist/internal/resolveLocale.js +2 -2
- package/dist/internal/resolveManualRoundingOptions.d.ts +1 -1
- package/dist/internal/resolveUnixIntervalPair.d.ts +1 -1
- package/dist/internal/rinexWeek.d.ts +22 -0
- package/dist/internal/rinexWeek.js +30 -0
- package/dist/internal/rollBusinessDate.d.ts +15 -0
- package/dist/internal/rollBusinessDate.js +46 -0
- package/dist/internal/splitStep.d.ts +1 -1
- package/dist/internal/splitStep.js +1 -1
- package/dist/internal/startOrEndOfUnix.d.ts +1 -1
- package/dist/internal/startOrEndOfUtc.d.ts +1 -1
- package/dist/internal/startOrEndOfUtc.js +1 -1
- package/dist/internal/startOrEndOfZoned.d.ts +1 -1
- package/dist/internal/temporal.d.ts +5 -0
- package/dist/internal/temporal.js +5 -0
- package/dist/internal/temporalCompat/calendarDateArithmetic.d.ts +1 -1
- package/dist/internal/temporalCompat/calendarDateFromFields.d.ts +1 -1
- package/dist/internal/temporalCompat/calendarDateFromFields.js +1 -1
- package/dist/internal/temporalCompat/calendarFields.d.ts +1 -1
- package/dist/internal/temporalCompat/capabilities.d.ts +27 -5
- package/dist/internal/temporalCompat/capabilities.js +28 -4
- package/dist/internal/temporalCompat/fieldSearch.d.ts +1 -1
- package/dist/internal/temporalCompat/fieldSearch.js +1 -1
- package/dist/internal/temporalCompat/fixedDay.d.ts +1 -1
- package/dist/internal/temporalCompat/fixedDay.js +1 -1
- package/dist/internal/temporalCompat/index.d.ts +1 -1
- package/dist/internal/temporalCompat/index.js +1 -1
- package/dist/internal/temporalCompat/largeMonthSpan.js +1 -1
- package/dist/internal/temporalCompat/nonIsoArithmetic.d.ts +1 -1
- package/dist/internal/temporalCompat/nonIsoArithmetic.js +1 -1
- package/dist/internal/temporalCompat/probeRepros.d.ts +35 -0
- package/dist/internal/temporalCompat/probeRepros.js +571 -0
- package/dist/internal/temporalCompat/readArithmeticModel.js +2 -2
- package/dist/internal/temporalCompat/repros.d.ts +3 -10
- package/dist/internal/temporalCompat/repros.js +13 -520
- package/dist/internal/timeScaleString.d.ts +47 -0
- package/dist/internal/timeScaleString.js +86 -0
- package/dist/internal/toInstantFromUtc.d.ts +1 -1
- package/dist/internal/toInstantFromUtc.js +1 -1
- package/dist/internal/unixEpochValue.d.ts +1 -1
- package/dist/internal/unixEpochValue.js +1 -1
- package/dist/internal/unixFormatReference.d.ts +1 -1
- package/dist/internal/unixFormatReference.js +1 -1
- package/dist/internal/unixWallClock.d.ts +1 -1
- package/dist/internal/utcOffsetString.d.ts +16 -0
- package/dist/internal/utcOffsetString.js +31 -1
- package/dist/internal/utcReading.d.ts +59 -0
- package/dist/internal/utcReading.js +113 -0
- package/dist/internal/utcWallClock.d.ts +1 -1
- package/dist/internal/utcWallClock.js +1 -1
- package/dist/internal/validatedZones.d.ts +20 -0
- package/dist/internal/validatedZones.js +33 -0
- package/dist/internal/wallClockAtOffset.d.ts +1 -1
- package/dist/internal/yearWindowStart.js +1 -1
- package/dist/internal/zoneBucketCap.d.ts +1 -1
- package/dist/internal/zoneBucketCap.js +2 -2
- package/dist/internal/zoneFrame.d.ts +4 -4
- package/dist/internal/zoneFrame.js +4 -4
- package/dist/internal/zonedBucket.d.ts +2 -2
- package/dist/internal/zonedBucket.js +92 -21
- package/dist/internal/zonedFormatReference.d.ts +1 -1
- package/dist/internal/zonedFormatReference.js +1 -1
- package/dist/internal/zonedLocalDates.d.ts +1 -1
- package/dist/internal/zonedLocalDates.js +22 -19
- package/dist/internal/zonedNowUnitValue.d.ts +1 -1
- package/dist/internal/zonedNowUnitValue.js +1 -1
- package/dist/internal/zonedTransitionSearch.d.ts +2 -0
- package/dist/internal/zonedTransitionSearch.js +165 -16
- package/dist/internal/zonedWallClock.d.ts +15 -4
- package/dist/internal/zonedWallClock.js +34 -6
- package/dist/internal/zonedWallClockDifference.d.ts +1 -1
- package/dist/internal/zonedWallClockDifference.js +2 -2
- package/dist/internal/zonedWallClockOperations.d.ts +2 -2
- package/dist/internal/zonedWallClockOperations.js +51 -6
- package/dist/internal/zonelessCalendarDate.d.ts +1 -1
- package/dist/internal/zonelessCalendarDate.js +1 -1
- package/dist/interval/index.d.ts +1 -1
- package/dist/interval/index.js +2 -2
- package/dist/plain/calculate/addBusinessDays.d.ts +2 -2
- package/dist/plain/calculate/addBusinessDays.js +2 -2
- package/dist/plain/calculate/addDateTime.js +1 -1
- package/dist/plain/calculate/addTime.js +1 -1
- package/dist/plain/calculate/clampDate.js +1 -1
- package/dist/plain/calculate/closestDateTo.js +1 -1
- package/dist/plain/calculate/cycleDate.js +1 -1
- package/dist/plain/calculate/cycleDateTime.js +1 -1
- package/dist/plain/calculate/cycleTime.js +1 -1
- package/dist/plain/calculate/diffDate.d.ts +1 -1
- package/dist/plain/calculate/diffDateAsDuration.d.ts +1 -1
- package/dist/plain/calculate/diffDateTime.d.ts +1 -1
- package/dist/plain/calculate/diffDateTime.js +1 -1
- package/dist/plain/calculate/diffDateTimeAsDuration.d.ts +1 -1
- package/dist/plain/calculate/diffDateTimeAsDuration.js +1 -1
- package/dist/plain/calculate/diffTime.d.ts +1 -1
- package/dist/plain/calculate/diffTime.js +1 -1
- package/dist/plain/calculate/endOfDate.d.ts +1 -1
- package/dist/plain/calculate/endOfDate.js +1 -1
- package/dist/plain/calculate/endOfDateTime.d.ts +1 -1
- package/dist/plain/calculate/endOfDateTime.js +1 -1
- package/dist/plain/calculate/endOfQuarterForDate.js +1 -1
- package/dist/plain/calculate/endOfQuarterForDateTime.js +1 -1
- package/dist/plain/calculate/endOfTime.d.ts +1 -1
- package/dist/plain/calculate/endOfTime.js +1 -1
- package/dist/plain/calculate/getDayOfYear.js +1 -1
- package/dist/plain/calculate/getDaysInMonth.js +1 -1
- package/dist/plain/calculate/getDaysInYear.js +1 -1
- package/dist/plain/calculate/getLargestDateDurationUnit.d.ts +1 -1
- package/dist/plain/calculate/getLargestDateTimeDurationUnit.d.ts +1 -1
- package/dist/plain/calculate/getLargestTimeDurationUnit.d.ts +1 -1
- package/dist/plain/calculate/getLocaleDayOfWeek.d.ts +6 -6
- package/dist/plain/calculate/getLocaleDayOfWeek.js +7 -7
- package/dist/plain/calculate/getLocaleEndOfWeek.d.ts +4 -4
- package/dist/plain/calculate/getLocaleEndOfWeek.js +5 -5
- package/dist/plain/calculate/getLocaleStartOfWeek.d.ts +5 -5
- package/dist/plain/calculate/getLocaleStartOfWeek.js +6 -6
- package/dist/plain/calculate/getLocaleWeekYear.d.ts +10 -10
- package/dist/plain/calculate/getLocaleWeekYear.js +11 -11
- package/dist/plain/calculate/getQuarterForDate.js +1 -1
- package/dist/plain/calculate/getQuarterForDateTime.js +1 -1
- package/dist/plain/calculate/getWeekNumber.js +1 -1
- package/dist/plain/calculate/getWeekOfMonth.d.ts +10 -14
- package/dist/plain/calculate/getWeekOfMonth.js +11 -15
- package/dist/plain/calculate/getWeekYear.js +1 -1
- package/dist/plain/calculate/getWeeksInLocaleWeekYear.d.ts +7 -7
- package/dist/plain/calculate/getWeeksInLocaleWeekYear.js +8 -8
- package/dist/plain/calculate/getWeeksInMonth.d.ts +8 -11
- package/dist/plain/calculate/getWeeksInMonth.js +9 -12
- package/dist/plain/calculate/getWeeksInYear.js +1 -1
- package/dist/plain/calculate/maxDate.js +1 -1
- package/dist/plain/calculate/maxDateTime.js +1 -1
- package/dist/plain/calculate/maxTime.js +1 -1
- package/dist/plain/calculate/minDate.js +1 -1
- package/dist/plain/calculate/minDateTime.js +1 -1
- package/dist/plain/calculate/minTime.js +1 -1
- package/dist/plain/calculate/nextWeekday.d.ts +14 -12
- package/dist/plain/calculate/nextWeekday.js +15 -13
- package/dist/plain/calculate/previousWeekday.d.ts +14 -12
- package/dist/plain/calculate/previousWeekday.js +15 -13
- package/dist/plain/calculate/roundDate.d.ts +1 -1
- package/dist/plain/calculate/roundDate.js +1 -1
- package/dist/plain/calculate/roundDateTime.d.ts +1 -1
- package/dist/plain/calculate/roundDateTime.js +1 -1
- package/dist/plain/calculate/roundTime.d.ts +1 -1
- package/dist/plain/calculate/roundTime.js +1 -1
- package/dist/plain/calculate/setDate.d.ts +1 -1
- package/dist/plain/calculate/setDate.js +1 -1
- package/dist/plain/calculate/setDateTime.d.ts +1 -1
- package/dist/plain/calculate/setDateTime.js +1 -1
- package/dist/plain/calculate/setTime.d.ts +1 -1
- package/dist/plain/calculate/setTime.js +1 -1
- package/dist/plain/calculate/sortDateTimes.js +1 -1
- package/dist/plain/calculate/sortDates.js +1 -1
- package/dist/plain/calculate/sortTimes.js +1 -1
- package/dist/plain/calculate/startOfDate.d.ts +1 -1
- package/dist/plain/calculate/startOfDate.js +1 -1
- package/dist/plain/calculate/startOfDateTime.d.ts +1 -1
- package/dist/plain/calculate/startOfDateTime.js +1 -1
- package/dist/plain/calculate/startOfQuarterForDate.js +1 -1
- package/dist/plain/calculate/startOfQuarterForDateTime.js +1 -1
- package/dist/plain/calculate/startOfTime.d.ts +1 -1
- package/dist/plain/calculate/startOfTime.js +1 -1
- package/dist/plain/calculate/subtractBusinessDays.d.ts +2 -2
- package/dist/plain/calculate/subtractBusinessDays.js +2 -2
- package/dist/plain/calculate/subtractDate.js +1 -1
- package/dist/plain/calculate/subtractDateTime.js +1 -1
- package/dist/plain/calculate/subtractTime.js +1 -1
- package/dist/plain/calculate/weekOfYearForDate.js +1 -1
- package/dist/plain/calculate/weekOfYearForDateTime.js +1 -1
- package/dist/plain/chop/chopDate.js +1 -1
- package/dist/plain/chop/chopMilliseconds.js +1 -1
- package/dist/plain/chop/chopSeconds.js +1 -1
- package/dist/plain/chop/chopTime.js +1 -1
- package/dist/plain/compare/areDateTimesEqual.js +1 -1
- package/dist/plain/compare/areDateTimesEqualBy.d.ts +2 -4
- package/dist/plain/compare/areDateTimesEqualBy.js +2 -4
- package/dist/plain/compare/areDatesEqual.js +1 -1
- package/dist/plain/compare/areDatesEqualBy.d.ts +5 -5
- package/dist/plain/compare/areDatesEqualBy.js +5 -5
- package/dist/plain/compare/areTimesEqual.js +1 -1
- package/dist/plain/compare/isAfterDate.js +1 -1
- package/dist/plain/compare/isAfterDateTime.js +1 -1
- package/dist/plain/compare/isAfterTime.js +1 -1
- package/dist/plain/compare/isBeforeDate.js +1 -1
- package/dist/plain/compare/isBeforeDateTime.js +1 -1
- package/dist/plain/compare/isBeforeTime.js +1 -1
- package/dist/plain/compare/isBetweenDate.js +1 -1
- package/dist/plain/compare/isBetweenDateTime.js +1 -1
- package/dist/plain/compare/isBetweenTime.js +1 -1
- package/dist/plain/compare/isBusinessDay.d.ts +2 -2
- package/dist/plain/compare/isBusinessDay.js +3 -3
- package/dist/plain/compare/isRelativeDay.d.ts +1 -1
- package/dist/plain/compare/isRelativeDay.js +1 -1
- package/dist/plain/compare/isThisUnit.d.ts +8 -6
- package/dist/plain/compare/isThisUnit.js +7 -5
- package/dist/plain/compare/isWeekend.d.ts +5 -5
- package/dist/plain/compare/isWeekend.js +6 -6
- package/dist/plain/format/formatCalendar.d.ts +3 -5
- package/dist/plain/format/formatCalendar.js +10 -9
- package/dist/plain/format/formatDate.d.ts +4 -4
- package/dist/plain/format/formatDate.js +8 -7
- package/dist/plain/format/formatDateRange.d.ts +4 -4
- package/dist/plain/format/formatDateRange.js +8 -7
- package/dist/plain/format/formatDateTime.d.ts +4 -4
- package/dist/plain/format/formatDateTime.js +8 -7
- package/dist/plain/format/formatDateTimeRange.d.ts +4 -4
- package/dist/plain/format/formatDateTimeRange.js +8 -7
- package/dist/plain/format/formatDateTimeToParts.d.ts +6 -6
- package/dist/plain/format/formatDateTimeToParts.js +10 -9
- package/dist/plain/format/formatDateToParts.d.ts +6 -6
- package/dist/plain/format/formatDateToParts.js +10 -9
- package/dist/plain/format/formatRelativeDate.d.ts +3 -3
- package/dist/plain/format/formatRelativeDate.js +4 -4
- package/dist/plain/format/formatRelativeDateTime.d.ts +3 -3
- package/dist/plain/format/formatRelativeDateTime.js +4 -4
- package/dist/plain/format/formatRelativeTime.d.ts +3 -3
- package/dist/plain/format/formatRelativeTime.js +4 -4
- package/dist/plain/format/formatSqlDateTime.js +1 -1
- package/dist/plain/format/formatTime.d.ts +4 -4
- package/dist/plain/format/formatTime.js +8 -7
- package/dist/plain/get/getDay.js +1 -1
- package/dist/plain/get/getDayOfWeek.js +1 -1
- package/dist/plain/get/getHour.js +1 -1
- package/dist/plain/get/getMicrosecond.js +1 -1
- package/dist/plain/get/getMillisecond.js +1 -1
- package/dist/plain/get/getMinute.js +1 -1
- package/dist/plain/get/getMonth.js +1 -1
- package/dist/plain/get/getNanosecond.js +1 -1
- package/dist/plain/get/getNow.js +1 -1
- package/dist/plain/get/getNowUnit.js +1 -1
- package/dist/plain/get/getSecond.js +1 -1
- package/dist/plain/get/getToday.js +1 -1
- package/dist/plain/get/getWeekOfYear.js +1 -1
- package/dist/plain/get/getYear.js +1 -1
- package/dist/plain/index.d.ts +1 -1
- package/dist/plain/index.js +2 -2
- package/dist/plain/interval/intervalAbutsDate.d.ts +1 -2
- package/dist/plain/interval/intervalAbutsDate.js +2 -3
- package/dist/plain/interval/intervalAbutsDateTime.js +1 -1
- package/dist/plain/interval/intervalAbutsTime.js +1 -1
- package/dist/plain/interval/intervalContainsDate.d.ts +1 -1
- package/dist/plain/interval/intervalContainsDate.js +2 -2
- package/dist/plain/interval/intervalContainsDateTime.js +1 -1
- package/dist/plain/interval/intervalContainsTime.js +1 -1
- package/dist/plain/interval/intervalCountDate.js +1 -1
- package/dist/plain/interval/intervalCountDateTime.js +1 -1
- package/dist/plain/interval/intervalCountTime.js +1 -1
- package/dist/plain/interval/intervalDifferenceDate.d.ts +1 -1
- package/dist/plain/interval/intervalDifferenceDate.js +2 -2
- package/dist/plain/interval/intervalDifferenceDateTime.js +1 -1
- package/dist/plain/interval/intervalDifferenceTime.js +1 -1
- package/dist/plain/interval/intervalDivideEquallyDate.d.ts +3 -3
- package/dist/plain/interval/intervalDivideEquallyDate.js +3 -3
- package/dist/plain/interval/intervalDivideEquallyDateTime.js +1 -1
- package/dist/plain/interval/intervalDivideEquallyTime.js +1 -1
- package/dist/plain/interval/intervalEngulfsDate.d.ts +1 -1
- package/dist/plain/interval/intervalEngulfsDate.js +2 -2
- package/dist/plain/interval/intervalEngulfsDateTime.js +1 -1
- package/dist/plain/interval/intervalEngulfsTime.js +1 -1
- package/dist/plain/interval/intervalFromDurationDate.js +1 -1
- package/dist/plain/interval/intervalFromDurationDateTime.js +1 -1
- package/dist/plain/interval/intervalFromDurationTime.js +1 -1
- package/dist/plain/interval/intervalIntersectionDate.d.ts +1 -1
- package/dist/plain/interval/intervalIntersectionDate.js +2 -2
- package/dist/plain/interval/intervalIntersectionDateTime.js +1 -1
- package/dist/plain/interval/intervalIntersectionTime.js +1 -1
- package/dist/plain/interval/intervalLengthDateTime.js +1 -1
- package/dist/plain/interval/intervalLengthTime.js +1 -1
- package/dist/plain/interval/intervalOverlappingDaysDate.js +1 -1
- package/dist/plain/interval/intervalOverlappingDaysDateTime.js +1 -1
- package/dist/plain/interval/intervalSplitAtDate.d.ts +1 -1
- package/dist/plain/interval/intervalSplitAtDate.js +2 -2
- package/dist/plain/interval/intervalSplitAtDateTime.js +1 -1
- package/dist/plain/interval/intervalSplitAtTime.js +1 -1
- package/dist/plain/interval/intervalUnionDate.d.ts +2 -2
- package/dist/plain/interval/intervalUnionDate.js +3 -3
- package/dist/plain/interval/intervalUnionDateTime.js +1 -1
- package/dist/plain/interval/intervalUnionTime.js +1 -1
- package/dist/plain/interval/intervalXorAllDate.d.ts +1 -1
- package/dist/plain/interval/intervalXorAllDate.js +2 -2
- package/dist/plain/interval/intervalXorAllDateTime.js +1 -1
- package/dist/plain/interval/intervalXorAllTime.js +1 -1
- package/dist/plain/interval/intervalXorDate.d.ts +1 -1
- package/dist/plain/interval/intervalXorDate.js +2 -2
- package/dist/plain/interval/intervalXorDateTime.js +1 -1
- package/dist/plain/interval/intervalXorTime.js +1 -1
- package/dist/plain/interval/intervalsOverlapDate.d.ts +1 -1
- package/dist/plain/interval/intervalsOverlapDate.js +2 -2
- package/dist/plain/interval/intervalsOverlapDateTime.js +1 -1
- package/dist/plain/interval/intervalsOverlapTime.js +1 -1
- package/dist/plain/interval/mergeIntervalsDate.d.ts +1 -1
- package/dist/plain/interval/mergeIntervalsDate.js +2 -2
- package/dist/plain/interval/mergeIntervalsDateTime.js +1 -1
- package/dist/plain/interval/mergeIntervalsTime.js +1 -1
- package/dist/plain/interval/splitIntervalByUnitDate.d.ts +2 -3
- package/dist/plain/interval/splitIntervalByUnitDate.js +3 -4
- package/dist/plain/interval/splitIntervalByUnitDateTime.d.ts +2 -1
- package/dist/plain/interval/splitIntervalByUnitDateTime.js +3 -2
- package/dist/plain/interval/splitIntervalByUnitTime.js +1 -1
- package/dist/plain/interval/validate/isValidDateInterval.d.ts +1 -1
- package/dist/plain/interval/validate/isValidDateInterval.js +2 -2
- package/dist/plain/interval/validate/isValidDateTimeInterval.js +1 -1
- package/dist/plain/interval/validate/isValidTimeInterval.js +1 -1
- package/dist/plain/locale/getLocaleEraNames.d.ts +6 -6
- package/dist/plain/locale/getLocaleEraNames.js +8 -7
- package/dist/plain/locale/getLocaleMeridiems.d.ts +5 -5
- package/dist/plain/locale/getLocaleMeridiems.js +7 -6
- package/dist/plain/locale/getLocaleMonthNames.d.ts +6 -6
- package/dist/plain/locale/getLocaleMonthNames.js +17 -11
- package/dist/plain/locale/getLocaleWeekdayNames.d.ts +3 -3
- package/dist/plain/locale/getLocaleWeekdayNames.js +12 -5
- package/dist/plain/map/mapDatesInRange.js +1 -1
- package/dist/plain/map/mapDaysInMonth.js +1 -1
- package/dist/plain/parse/parseDateTimeWithPattern.d.ts +14 -13
- package/dist/plain/parse/parseDateTimeWithPattern.js +15 -14
- package/dist/plain/parse/parseDateWithPattern.d.ts +18 -17
- package/dist/plain/parse/parseDateWithPattern.js +19 -18
- package/dist/plain/parse/parseDayFromDate.js +1 -1
- package/dist/plain/parse/parseDayFromDateTime.js +1 -1
- package/dist/plain/parse/parseDayOfWeekFromDate.js +1 -1
- package/dist/plain/parse/parseDayOfWeekFromDateTime.js +1 -1
- package/dist/plain/parse/parseHourFromDateTime.js +1 -1
- package/dist/plain/parse/parseHourFromTime.js +1 -1
- package/dist/plain/parse/parseMicrosecondFromDateTime.js +1 -1
- package/dist/plain/parse/parseMicrosecondFromTime.js +1 -1
- package/dist/plain/parse/parseMillisecondFromDateTime.js +1 -1
- package/dist/plain/parse/parseMillisecondFromTime.js +1 -1
- package/dist/plain/parse/parseMinuteFromDateTime.js +1 -1
- package/dist/plain/parse/parseMinuteFromTime.js +1 -1
- package/dist/plain/parse/parseMonthFromDate.js +1 -1
- package/dist/plain/parse/parseMonthFromDateTime.js +1 -1
- package/dist/plain/parse/parseNanosecondFromDateTime.js +1 -1
- package/dist/plain/parse/parseNanosecondFromTime.js +1 -1
- package/dist/plain/parse/parseSecondFromDateTime.js +1 -1
- package/dist/plain/parse/parseSecondFromTime.js +1 -1
- package/dist/plain/parse/parseSqlDateTime.js +1 -1
- package/dist/plain/parse/parseTimeWithPattern.d.ts +6 -4
- package/dist/plain/parse/parseTimeWithPattern.js +7 -5
- package/dist/plain/parse/parseUnitFromDate.d.ts +1 -1
- package/dist/plain/parse/parseUnitFromDate.js +1 -1
- package/dist/plain/parse/parseUnitFromDateTime.d.ts +1 -1
- package/dist/plain/parse/parseUnitFromDateTime.js +1 -1
- package/dist/plain/parse/parseUnitFromTime.d.ts +1 -1
- package/dist/plain/parse/parseUnitFromTime.js +1 -1
- package/dist/plain/parse/parseWeekFromDateTime.js +1 -1
- package/dist/plain/parse/parseYearFromDate.js +1 -1
- package/dist/plain/parse/parseYearFromDateTime.js +1 -1
- package/dist/plain/validate/{isLeapSecond.d.ts → hasSecond60.d.ts} +16 -14
- package/dist/plain/validate/{isLeapSecond.js → hasSecond60.js} +16 -14
- package/dist/plain/validate/index.d.ts +1 -1
- package/dist/plain/validate/index.js +1 -1
- package/dist/plain/validate/isLeapYear.js +1 -1
- package/dist/plain/validate/isValidDate.js +2 -17
- package/dist/plain/validate/isValidDateRange.js +1 -1
- package/dist/plain/validate/isValidDateTime.d.ts +1 -1
- package/dist/plain/validate/isValidDateTime.js +4 -4
- package/dist/plain/validate/isValidDateTimeRange.js +1 -1
- package/dist/plain/validate/isValidIsoDateLike.js +3 -3
- package/dist/plain/validate/isValidTime.js +2 -18
- package/dist/plain/validate/isValidTimeRange.js +1 -1
- package/dist/precision/convert/fromNanoseconds.d.ts +2 -2
- package/dist/precision/convert/fromNanoseconds.js +3 -3
- package/dist/precision/convert/toNanoseconds.d.ts +2 -2
- package/dist/precision/convert/toNanoseconds.js +2 -2
- package/dist/precision/index.d.ts +1 -1
- package/dist/precision/index.js +2 -2
- package/dist/precision/validate/isValidInstant.d.ts +1 -1
- package/dist/precision/validate/isValidInstant.js +1 -1
- package/dist/regex/calendar-zoned-date-time.d.ts +4 -4
- package/dist/regex/calendar-zoned-date-time.js +4 -4
- package/dist/regex/index.d.ts +1 -1
- package/dist/regex/index.js +2 -2
- package/dist/regex/leap-second.d.ts +1 -1
- package/dist/regex/leap-second.js +1 -1
- package/dist/regex/time-zone-like.d.ts +2 -2
- package/dist/regex/time-zone-like.js +2 -2
- package/dist/span/calculate/spanMs.d.ts +4 -3
- package/dist/span/calculate/spanMs.js +4 -3
- package/dist/span/calculate/spanNs.d.ts +4 -3
- package/dist/span/calculate/spanNs.js +4 -3
- package/dist/span/calculate/spanWallClock.d.ts +12 -12
- package/dist/span/calculate/spanWallClock.js +13 -13
- package/dist/span/index.d.ts +1 -1
- package/dist/span/index.js +2 -2
- package/dist/span/validate/isValidSpan.d.ts +3 -3
- package/dist/span/validate/isValidSpan.js +3 -3
- package/dist/timescale/calculate/index.d.ts +3 -0
- package/dist/timescale/calculate/index.js +3 -0
- package/dist/timescale/calculate/leapSecondsBetween.d.ts +26 -0
- package/dist/timescale/calculate/leapSecondsBetween.js +62 -0
- package/dist/timescale/calculate/nextLeapSecond.d.ts +18 -0
- package/dist/timescale/calculate/nextLeapSecond.js +33 -0
- package/dist/timescale/calculate/taiMinusUtc.d.ts +21 -0
- package/dist/timescale/calculate/taiMinusUtc.js +38 -0
- package/dist/timescale/convert/fromTAI.d.ts +22 -0
- package/dist/timescale/convert/fromTAI.js +35 -0
- package/dist/timescale/convert/index.d.ts +2 -0
- package/dist/timescale/convert/index.js +2 -0
- package/dist/timescale/convert/toTAI.d.ts +23 -0
- package/dist/timescale/convert/toTAI.js +39 -0
- package/dist/timescale/index.d.ts +4 -0
- package/dist/timescale/index.js +5 -0
- package/dist/timescale/validate/index.d.ts +1 -0
- package/dist/timescale/validate/index.js +1 -0
- package/dist/timescale/validate/isLeapSecond.d.ts +25 -0
- package/dist/timescale/validate/isLeapSecond.js +36 -0
- package/dist/transport/calculate/crossingTime.d.ts +2 -2
- package/dist/transport/calculate/crossingTime.js +3 -3
- package/dist/transport/calculate/cutoffAt.d.ts +4 -4
- package/dist/transport/calculate/cutoffAt.js +24 -133
- package/dist/transport/calculate/cutoffSchedule.d.ts +2 -2
- package/dist/transport/calculate/cutoffSchedule.js +52 -20
- package/dist/transport/calculate/dwellTime.d.ts +3 -3
- package/dist/transport/calculate/dwellTime.js +4 -4
- package/dist/transport/calculate/estimateDrift.d.ts +1 -1
- package/dist/transport/calculate/estimateDrift.js +1 -1
- package/dist/transport/calculate/nextDeparture.d.ts +2 -2
- package/dist/transport/calculate/nextDeparture.js +2 -2
- package/dist/transport/calculate/scheduleDelivery.d.ts +2 -2
- package/dist/transport/calculate/scheduleDelivery.js +3 -3
- package/dist/transport/calculate/transitTime.d.ts +11 -11
- package/dist/transport/calculate/transitTime.js +11 -11
- package/dist/transport/compare/classifyPunctuality.d.ts +1 -1
- package/dist/transport/compare/classifyPunctuality.js +1 -1
- package/dist/transport/compare/isPastCutoff.d.ts +1 -1
- package/dist/transport/compare/isPastCutoff.js +2 -2
- package/dist/transport/compare/scheduleDeviation.d.ts +1 -1
- package/dist/transport/compare/scheduleDeviation.js +1 -1
- package/dist/transport/compare/timeToCutoff.d.ts +1 -1
- package/dist/transport/compare/timeToCutoff.js +1 -1
- package/dist/transport/convert/etaAtZone.d.ts +2 -2
- package/dist/transport/convert/etaAtZone.js +2 -2
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +2 -2
- package/dist/types/date-duration-unit.d.ts +1 -1
- package/dist/types/date-time-duration-units.d.ts +1 -1
- package/dist/types/date-time-unit.d.ts +1 -1
- package/dist/types/date-unit.d.ts +1 -1
- package/dist/types/disambiguation.d.ts +1 -1
- package/dist/types/duration-relative-to.d.ts +1 -1
- package/dist/types/duration-string-options.d.ts +1 -1
- package/dist/types/exact-duration-unit.d.ts +1 -1
- package/dist/types/fiscal-calendar.d.ts +40 -4
- package/dist/types/gnss.d.ts +51 -0
- package/dist/types/gnss.js +0 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/now-unit.d.ts +1 -1
- package/dist/types/offset.d.ts +1 -1
- package/dist/types/overflow.d.ts +1 -1
- package/dist/types/rounding-options.d.ts +1 -1
- package/dist/types/stored-zoned-classification.d.ts +83 -0
- package/dist/types/stored-zoned-classification.js +0 -0
- package/dist/types/time-duration-unit.d.ts +1 -1
- package/dist/types/time-unit.d.ts +1 -1
- package/dist/types/utc-now-unit.d.ts +1 -1
- package/dist/unix/calculate/diffUnix.d.ts +1 -1
- package/dist/unix/calculate/diffUnixAsDuration.d.ts +1 -1
- package/dist/unix/calculate/endOfUnix.d.ts +2 -2
- package/dist/unix/calculate/endOfUnix.js +1 -1
- package/dist/unix/calculate/isBetweenUnix.js +1 -1
- package/dist/unix/calculate/roundUnix.d.ts +7 -5
- package/dist/unix/calculate/roundUnix.js +6 -4
- package/dist/unix/calculate/setUnix.d.ts +3 -3
- package/dist/unix/calculate/setUnix.js +2 -2
- package/dist/unix/calculate/startOfUnix.d.ts +2 -2
- package/dist/unix/calculate/startOfUnix.js +1 -1
- package/dist/unix/compare/areUnixEqualBy.d.ts +6 -6
- package/dist/unix/compare/areUnixEqualBy.js +5 -5
- package/dist/unix/convert/convertUnixToPlainTime.d.ts +1 -1
- package/dist/unix/convert/convertUnixToPlainTime.js +1 -1
- package/dist/unix/convert/convertUnixToZoned.d.ts +1 -1
- package/dist/unix/convert/convertUnixToZoned.js +1 -1
- package/dist/unix/format/formatCalendarUnix.d.ts +10 -9
- package/dist/unix/format/formatCalendarUnix.js +6 -6
- package/dist/unix/format/formatRelativeUnix.d.ts +7 -7
- package/dist/unix/format/formatRelativeUnix.js +7 -7
- package/dist/unix/format/formatUnix.d.ts +9 -9
- package/dist/unix/format/formatUnix.js +9 -9
- package/dist/unix/get/getUnixDay.js +1 -1
- package/dist/unix/get/getUnixHour.js +1 -1
- package/dist/unix/get/getUnixMicrosecond.js +1 -1
- package/dist/unix/get/getUnixMillisecond.js +1 -1
- package/dist/unix/get/getUnixMinute.js +1 -1
- package/dist/unix/get/getUnixMonth.js +1 -1
- package/dist/unix/get/getUnixNanosecond.js +1 -1
- package/dist/unix/get/getUnixNow.js +1 -1
- package/dist/unix/get/getUnixNowUnit.d.ts +1 -1
- package/dist/unix/get/getUnixNowUnit.js +1 -1
- package/dist/unix/get/getUnixSecond.js +1 -1
- package/dist/unix/get/getUnixYear.js +1 -1
- package/dist/unix/index.d.ts +1 -1
- package/dist/unix/index.js +2 -2
- package/dist/unix/interval/intervalFromDurationUnix.js +1 -1
- package/dist/unix/interval/intervalLengthUnix.d.ts +2 -2
- package/dist/unix/interval/intervalLengthUnix.js +2 -2
- package/dist/unix/interval/splitIntervalByUnitUnix.d.ts +3 -2
- package/dist/unix/interval/splitIntervalByUnitUnix.js +4 -3
- package/dist/unix/parse/parseUnitFromUnix.d.ts +1 -1
- package/dist/utc/calculate/addUtc.js +1 -1
- package/dist/utc/calculate/diffUtc.d.ts +1 -1
- package/dist/utc/calculate/diffUtc.js +1 -1
- package/dist/utc/calculate/diffUtcAsDuration.d.ts +1 -1
- package/dist/utc/calculate/diffUtcAsDuration.js +1 -1
- package/dist/utc/calculate/endOfQuarterForUtc.js +1 -1
- package/dist/utc/calculate/endOfUtc.d.ts +1 -1
- package/dist/utc/calculate/isBetweenUtc.js +1 -1
- package/dist/utc/calculate/maxUtc.js +1 -1
- package/dist/utc/calculate/minUtc.js +1 -1
- package/dist/utc/calculate/roundUtc.d.ts +1 -1
- package/dist/utc/calculate/roundUtc.js +1 -1
- package/dist/utc/calculate/setUtc.d.ts +1 -1
- package/dist/utc/calculate/setUtc.js +1 -1
- package/dist/utc/calculate/sortUtc.js +1 -1
- package/dist/utc/calculate/startOfQuarterForUtc.js +1 -1
- package/dist/utc/calculate/startOfUtc.d.ts +1 -1
- package/dist/utc/calculate/subtractUtc.js +1 -1
- package/dist/utc/compare/areUtcEqual.js +1 -1
- package/dist/utc/compare/areUtcEqualBy.d.ts +2 -2
- package/dist/utc/compare/areUtcEqualBy.js +2 -2
- package/dist/utc/compare/isAfterUtc.js +1 -1
- package/dist/utc/compare/isBeforeUtc.js +1 -1
- package/dist/utc/convert/convertUtcToPlainDate.d.ts +1 -1
- package/dist/utc/convert/convertUtcToPlainDate.js +2 -2
- package/dist/utc/convert/convertUtcToPlainDateTime.d.ts +1 -1
- package/dist/utc/convert/convertUtcToPlainDateTime.js +2 -2
- package/dist/utc/convert/convertUtcToPlainTime.d.ts +1 -1
- package/dist/utc/convert/convertUtcToPlainTime.js +2 -2
- package/dist/utc/convert/convertUtcToUnix.js +1 -1
- package/dist/utc/convert/convertUtcToZoned.d.ts +1 -1
- package/dist/utc/convert/convertUtcToZoned.js +2 -2
- package/dist/utc/format/formatCalendarUtc.d.ts +6 -5
- package/dist/utc/format/formatCalendarUtc.js +3 -3
- package/dist/utc/format/formatHttpDate.js +1 -1
- package/dist/utc/format/formatRelativeUtc.d.ts +5 -5
- package/dist/utc/format/formatRelativeUtc.js +5 -5
- package/dist/utc/format/formatUtc.d.ts +8 -8
- package/dist/utc/format/formatUtc.js +8 -8
- package/dist/utc/get/getUtcDay.js +1 -1
- package/dist/utc/get/getUtcHour.js +1 -1
- package/dist/utc/get/getUtcMicrosecond.js +1 -1
- package/dist/utc/get/getUtcMillisecond.js +1 -1
- package/dist/utc/get/getUtcMinute.js +1 -1
- package/dist/utc/get/getUtcMonth.js +1 -1
- package/dist/utc/get/getUtcNanosecond.js +1 -1
- package/dist/utc/get/getUtcNow.js +1 -1
- package/dist/utc/get/getUtcNowUnit.js +1 -1
- package/dist/utc/get/getUtcSecond.js +1 -1
- package/dist/utc/get/getUtcYear.js +1 -1
- package/dist/utc/index.d.ts +1 -1
- package/dist/utc/index.js +2 -2
- package/dist/utc/interval/intervalAbutsUtc.js +1 -1
- package/dist/utc/interval/intervalContainsUtc.js +1 -1
- package/dist/utc/interval/intervalCountUtc.js +1 -1
- package/dist/utc/interval/intervalDivideEquallyUtc.js +1 -1
- package/dist/utc/interval/intervalEngulfsUtc.js +1 -1
- package/dist/utc/interval/intervalFromDurationUtc.js +1 -1
- package/dist/utc/interval/intervalLengthUtc.js +1 -1
- package/dist/utc/interval/intervalOverlappingDaysUtc.js +1 -1
- package/dist/utc/interval/intervalSplitAtUtc.js +1 -1
- package/dist/utc/interval/intervalXorAllUtc.js +1 -1
- package/dist/utc/interval/intervalXorUtc.js +1 -1
- package/dist/utc/interval/splitIntervalByUnitUtc.d.ts +2 -1
- package/dist/utc/interval/splitIntervalByUnitUtc.js +3 -2
- package/dist/utc/interval/validate/isValidUtcInterval.js +1 -1
- package/dist/utc/parse/parseDateFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseDateFromUtc.js +1 -1
- package/dist/utc/parse/parseDayFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseDayFromUtc.js +1 -1
- package/dist/utc/parse/parseDayOfWeekFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseDayOfWeekFromUtc.js +2 -2
- package/dist/utc/parse/parseHourFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseHourFromUtc.js +1 -1
- package/dist/utc/parse/parseHttpDate.js +1 -1
- package/dist/utc/parse/parseMicrosecondFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseMicrosecondFromUtc.js +1 -1
- package/dist/utc/parse/parseMillisecondFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseMillisecondFromUtc.js +1 -1
- package/dist/utc/parse/parseMonthFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseMonthFromUtc.js +1 -1
- package/dist/utc/parse/parseNanosecondFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseNanosecondFromUtc.js +1 -1
- package/dist/utc/parse/parseSecondFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseSecondFromUtc.js +1 -1
- package/dist/utc/parse/parseTimeFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseTimeFromUtc.js +2 -2
- package/dist/utc/parse/parseUnitFromUtc.d.ts +2 -2
- package/dist/utc/parse/parseUnitFromUtc.js +2 -2
- package/dist/utc/parse/parseWeekFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseWeekFromUtc.js +2 -2
- package/dist/utc/parse/parseYearFromUtc.d.ts +1 -1
- package/dist/utc/parse/parseYearFromUtc.js +1 -1
- package/dist/utc/validate/isValidUtc.js +3 -3
- package/dist/utc/validate/isValidUtcRange.js +1 -1
- package/dist/{duty → workforce}/calculate/dutyDayFor.js +1 -1
- package/dist/{duty → workforce}/calculate/evaluateDutyLog.js +1 -1
- package/dist/{duty → workforce}/calculate/longestRun.js +1 -1
- package/dist/{duty → workforce}/calculate/qualifyingRestPairs.js +1 -1
- package/dist/{duty → workforce}/calculate/qualifyingRests.js +1 -1
- package/dist/workforce/index.d.ts +3 -0
- package/dist/workforce/index.js +4 -0
- package/dist/{duty → workforce}/validate/isValidDutyLog.d.ts +2 -2
- package/dist/{duty → workforce}/validate/isValidDutyLog.js +2 -2
- package/dist/zoned/calculate/addZoned.d.ts +15 -15
- package/dist/zoned/calculate/addZoned.js +15 -15
- package/dist/zoned/calculate/addZonedBusinessDays.d.ts +5 -4
- package/dist/zoned/calculate/addZonedBusinessDays.js +5 -4
- package/dist/zoned/calculate/clampZoned.js +1 -1
- package/dist/zoned/calculate/diffZoned.d.ts +8 -8
- package/dist/zoned/calculate/diffZoned.js +7 -7
- package/dist/zoned/calculate/diffZonedAsDuration.d.ts +5 -5
- package/dist/zoned/calculate/diffZonedAsDuration.js +4 -4
- package/dist/zoned/calculate/endOfZoned.d.ts +3 -3
- package/dist/zoned/calculate/endOfZoned.js +2 -2
- package/dist/zoned/calculate/getHoursInZonedDay.d.ts +2 -2
- package/dist/zoned/calculate/getHoursInZonedDay.js +2 -2
- package/dist/zoned/calculate/getLocaleZonedDayOfWeek.d.ts +6 -5
- package/dist/zoned/calculate/getLocaleZonedDayOfWeek.js +6 -5
- package/dist/zoned/calculate/getLocaleZonedEndOfWeek.d.ts +5 -5
- package/dist/zoned/calculate/getLocaleZonedEndOfWeek.js +5 -5
- package/dist/zoned/calculate/getLocaleZonedStartOfWeek.d.ts +6 -6
- package/dist/zoned/calculate/getLocaleZonedStartOfWeek.js +6 -6
- package/dist/zoned/calculate/maxZoned.d.ts +2 -2
- package/dist/zoned/calculate/maxZoned.js +3 -3
- package/dist/zoned/calculate/minZoned.d.ts +2 -2
- package/dist/zoned/calculate/minZoned.js +3 -3
- package/dist/zoned/calculate/roundZoned.d.ts +11 -9
- package/dist/zoned/calculate/roundZoned.js +11 -9
- package/dist/zoned/calculate/setZoned.d.ts +8 -8
- package/dist/zoned/calculate/setZoned.js +8 -8
- package/dist/zoned/calculate/sortZoned.d.ts +3 -3
- package/dist/zoned/calculate/sortZoned.js +4 -4
- package/dist/zoned/calculate/startOfZoned.d.ts +3 -3
- package/dist/zoned/calculate/startOfZoned.js +2 -2
- package/dist/zoned/calculate/subtractZoned.d.ts +14 -14
- package/dist/zoned/calculate/subtractZoned.js +14 -14
- package/dist/zoned/calculate/subtractZonedBusinessDays.d.ts +5 -4
- package/dist/zoned/calculate/subtractZonedBusinessDays.js +5 -4
- package/dist/zoned/chop/chopZonedDate.d.ts +1 -1
- package/dist/zoned/chop/chopZonedDate.js +1 -1
- package/dist/zoned/chop/chopZonedMilliseconds.d.ts +1 -1
- package/dist/zoned/chop/chopZonedMilliseconds.js +1 -1
- package/dist/zoned/chop/chopZonedSeconds.d.ts +1 -1
- package/dist/zoned/chop/chopZonedSeconds.js +1 -1
- package/dist/zoned/chop/chopZonedTime.d.ts +1 -1
- package/dist/zoned/chop/chopZonedTime.js +1 -1
- package/dist/zoned/chop/chopZonedTimezone.d.ts +1 -1
- package/dist/zoned/chop/chopZonedTimezone.js +1 -1
- package/dist/zoned/classify/classifyStoredZoned.d.ts +46 -0
- package/dist/zoned/classify/classifyStoredZoned.js +177 -0
- package/dist/zoned/classify/index.d.ts +1 -0
- package/dist/zoned/classify/index.js +1 -0
- package/dist/zoned/compare/areZonedEqual.js +1 -1
- package/dist/zoned/compare/areZonedEqualBy.d.ts +8 -10
- package/dist/zoned/compare/areZonedEqualBy.js +8 -10
- package/dist/zoned/compare/isAfterZoned.js +1 -1
- package/dist/zoned/compare/isBeforeZoned.d.ts +2 -2
- package/dist/zoned/compare/isBeforeZoned.js +3 -3
- package/dist/zoned/compare/isBetweenZoned.js +1 -1
- package/dist/zoned/compare/isInDaylightSaving.d.ts +2 -2
- package/dist/zoned/compare/isInDaylightSaving.js +2 -2
- package/dist/zoned/compare/isZonedBusinessDay.d.ts +7 -6
- package/dist/zoned/compare/isZonedBusinessDay.js +7 -6
- package/dist/zoned/compare/isZonedFuture.js +1 -1
- package/dist/zoned/compare/isZonedPast.js +1 -1
- package/dist/zoned/compare/isZonedRelativeDay.d.ts +2 -2
- package/dist/zoned/compare/isZonedRelativeDay.js +3 -3
- package/dist/zoned/compare/isZonedThisUnit.d.ts +7 -7
- package/dist/zoned/compare/isZonedThisUnit.js +7 -7
- package/dist/zoned/compare/isZonedWeekend.d.ts +5 -5
- package/dist/zoned/compare/isZonedWeekend.js +5 -5
- package/dist/zoned/convert/convertPlainDateTimeToZoned.d.ts +6 -6
- package/dist/zoned/convert/convertPlainDateTimeToZoned.js +6 -6
- package/dist/zoned/convert/convertZonedToCalendar.d.ts +5 -5
- package/dist/zoned/convert/convertZonedToCalendar.js +5 -5
- package/dist/zoned/convert/convertZonedToPlainDateTime.d.ts +3 -3
- package/dist/zoned/convert/convertZonedToPlainDateTime.js +3 -3
- package/dist/zoned/convert/convertZonedToZoned.d.ts +2 -2
- package/dist/zoned/convert/convertZonedToZoned.js +2 -2
- package/dist/zoned/format/formatCalendarZoned.d.ts +7 -6
- package/dist/zoned/format/formatCalendarZoned.js +5 -5
- package/dist/zoned/format/formatRelativeZoned.d.ts +3 -3
- package/dist/zoned/format/formatRelativeZoned.js +4 -4
- package/dist/zoned/format/formatRfc2822.d.ts +3 -3
- package/dist/zoned/format/formatRfc2822.js +3 -3
- package/dist/zoned/format/formatRfc3339.d.ts +2 -2
- package/dist/zoned/format/formatRfc3339.js +2 -2
- package/dist/zoned/format/formatTimeZoneName.d.ts +17 -17
- package/dist/zoned/format/formatTimeZoneName.js +13 -12
- package/dist/zoned/format/formatZonedDateTime.d.ts +10 -10
- package/dist/zoned/format/formatZonedDateTime.js +12 -11
- package/dist/zoned/format/formatZonedRange.d.ts +7 -7
- package/dist/zoned/format/formatZonedRange.js +9 -8
- package/dist/zoned/format/formatZonedToParts.d.ts +11 -11
- package/dist/zoned/format/formatZonedToParts.js +13 -12
- package/dist/zoned/get/getDstTransitions.d.ts +9 -9
- package/dist/zoned/get/getDstTransitions.js +3 -3
- package/dist/zoned/get/getSystemTimeZone.d.ts +2 -2
- package/dist/zoned/get/getSystemTimeZone.js +2 -2
- package/dist/zoned/get/getTimeZoneOffset.d.ts +5 -5
- package/dist/zoned/get/getTimeZoneOffset.js +5 -5
- package/dist/zoned/get/getTimeZones.d.ts +1 -1
- package/dist/zoned/get/getTimeZones.js +1 -1
- package/dist/zoned/get/getZonedDay.d.ts +1 -1
- package/dist/zoned/get/getZonedDay.js +1 -1
- package/dist/zoned/get/getZonedDayOfWeek.d.ts +1 -1
- package/dist/zoned/get/getZonedDayOfWeek.js +1 -1
- package/dist/zoned/get/getZonedHour.d.ts +1 -1
- package/dist/zoned/get/getZonedHour.js +1 -1
- package/dist/zoned/get/getZonedMicrosecond.d.ts +1 -1
- package/dist/zoned/get/getZonedMicrosecond.js +1 -1
- package/dist/zoned/get/getZonedMillisecond.d.ts +1 -1
- package/dist/zoned/get/getZonedMillisecond.js +1 -1
- package/dist/zoned/get/getZonedMinute.d.ts +1 -1
- package/dist/zoned/get/getZonedMinute.js +1 -1
- package/dist/zoned/get/getZonedMonth.d.ts +1 -1
- package/dist/zoned/get/getZonedMonth.js +1 -1
- package/dist/zoned/get/getZonedNanosecond.d.ts +1 -1
- package/dist/zoned/get/getZonedNanosecond.js +1 -1
- package/dist/zoned/get/getZonedNow.d.ts +4 -4
- package/dist/zoned/get/getZonedNow.js +4 -4
- package/dist/zoned/get/getZonedNowUnit.d.ts +2 -2
- package/dist/zoned/get/getZonedNowUnit.js +1 -1
- package/dist/zoned/get/getZonedSecond.d.ts +1 -1
- package/dist/zoned/get/getZonedSecond.js +1 -1
- package/dist/zoned/get/getZonedToday.d.ts +1 -1
- package/dist/zoned/get/getZonedToday.js +1 -1
- package/dist/zoned/get/getZonedWeekOfYear.d.ts +1 -1
- package/dist/zoned/get/getZonedWeekOfYear.js +1 -1
- package/dist/zoned/get/getZonedYear.d.ts +1 -1
- package/dist/zoned/get/getZonedYear.js +1 -1
- package/dist/zoned/index.d.ts +2 -1
- package/dist/zoned/index.js +3 -2
- package/dist/zoned/interval/intervalAbutsZoned.d.ts +2 -2
- package/dist/zoned/interval/intervalAbutsZoned.js +3 -3
- package/dist/zoned/interval/intervalContainsZoned.d.ts +1 -1
- package/dist/zoned/interval/intervalContainsZoned.js +2 -2
- package/dist/zoned/interval/intervalCountZoned.d.ts +4 -4
- package/dist/zoned/interval/intervalCountZoned.js +5 -5
- package/dist/zoned/interval/intervalDifferenceZoned.js +1 -1
- package/dist/zoned/interval/intervalDivideEquallyZoned.d.ts +1 -1
- package/dist/zoned/interval/intervalDivideEquallyZoned.js +2 -2
- package/dist/zoned/interval/intervalEngulfsZoned.d.ts +1 -1
- package/dist/zoned/interval/intervalEngulfsZoned.js +2 -2
- package/dist/zoned/interval/intervalFromDurationZoned.d.ts +6 -6
- package/dist/zoned/interval/intervalFromDurationZoned.js +7 -7
- package/dist/zoned/interval/intervalIntersectionZoned.js +1 -1
- package/dist/zoned/interval/intervalLengthZoned.d.ts +5 -5
- package/dist/zoned/interval/intervalLengthZoned.js +5 -5
- package/dist/zoned/interval/intervalOverlappingDaysZoned.d.ts +2 -2
- package/dist/zoned/interval/intervalOverlappingDaysZoned.js +3 -3
- package/dist/zoned/interval/intervalSplitAtZoned.js +14 -16
- package/dist/zoned/interval/intervalUnionZoned.js +1 -1
- package/dist/zoned/interval/intervalXorAllZoned.js +1 -1
- package/dist/zoned/interval/intervalXorZoned.js +1 -1
- package/dist/zoned/interval/intervalsOverlapZoned.d.ts +2 -2
- package/dist/zoned/interval/intervalsOverlapZoned.js +3 -3
- package/dist/zoned/interval/mergeIntervalsZoned.js +1 -1
- package/dist/zoned/interval/splitIntervalByUnitZoned.d.ts +2 -1
- package/dist/zoned/interval/splitIntervalByUnitZoned.js +3 -2
- package/dist/zoned/interval/validate/isValidCalendarZonedInterval.d.ts +2 -2
- package/dist/zoned/interval/validate/isValidCalendarZonedInterval.js +3 -3
- package/dist/zoned/interval/validate/isValidZonedInterval.d.ts +1 -1
- package/dist/zoned/interval/validate/isValidZonedInterval.js +2 -2
- package/dist/zoned/map/mapZonedDatesInRange.js +1 -1
- package/dist/zoned/map/mapZonedHoursInDay.d.ts +1 -1
- package/dist/zoned/map/mapZonedHoursInDay.js +2 -2
- package/dist/zoned/parse/getZonedOffset.d.ts +1 -1
- package/dist/zoned/parse/getZonedOffset.js +1 -1
- package/dist/zoned/parse/getZonedOffsetAs.d.ts +6 -6
- package/dist/zoned/parse/getZonedOffsetAs.js +3 -3
- package/dist/zoned/parse/parseDateTimeFromZoned.js +2 -2
- package/dist/zoned/parse/parseRfc2822.js +1 -1
- package/dist/zoned/parse/parseRfc3339.js +1 -1
- package/dist/zoned/parse/parseUnitFromZoned.d.ts +1 -1
- package/dist/zoned/validate/hasDaylightSaving.d.ts +2 -2
- package/dist/zoned/validate/hasDaylightSaving.js +3 -3
- package/dist/zoned/validate/isValidCalendarZonedDateTime.d.ts +8 -8
- package/dist/zoned/validate/isValidCalendarZonedDateTime.js +8 -8
- package/dist/zoned/validate/isValidTimeZone.d.ts +1 -1
- package/dist/zoned/validate/isValidTimeZone.js +3 -18
- package/dist/zoned/validate/isValidZonedDateTime.d.ts +7 -7
- package/dist/zoned/validate/isValidZonedDateTime.js +9 -9
- package/dist/zoned/validate/isValidZonedRange.d.ts +1 -1
- package/dist/zoned/validate/isValidZonedRange.js +5 -5
- package/package.json +71 -21
- package/skills/gmt-arithmetic/SKILL.md +18 -59
- package/skills/gmt-basics/SKILL.md +32 -12
- package/skills/gmt-gnss/SKILL.md +92 -0
- package/skills/gmt-integration/SKILL.md +48 -15
- package/skills/gmt-intermodal/SKILL.md +189 -0
- package/skills/gmt-timezone/SKILL.md +34 -257
- package/skills/gmt-transport/SKILL.md +133 -0
- package/skills/gmt-workforce/SKILL.md +84 -0
- package/dist/duty/index.d.ts +0 -3
- package/dist/duty/index.js +0 -4
- /package/dist/{duty → workforce}/calculate/dutyDayFor.d.ts +0 -0
- /package/dist/{duty → workforce}/calculate/dutyTotals.d.ts +0 -0
- /package/dist/{duty → workforce}/calculate/dutyTotals.js +0 -0
- /package/dist/{duty → workforce}/calculate/dutyViolations.d.ts +0 -0
- /package/dist/{duty → workforce}/calculate/dutyViolations.js +0 -0
- /package/dist/{duty → workforce}/calculate/evaluateDutyLog.d.ts +0 -0
- /package/dist/{duty → workforce}/calculate/index.d.ts +0 -0
- /package/dist/{duty → workforce}/calculate/index.js +0 -0
- /package/dist/{duty → workforce}/calculate/longestRun.d.ts +0 -0
- /package/dist/{duty → workforce}/calculate/qualifyingRestPairs.d.ts +0 -0
- /package/dist/{duty → workforce}/calculate/qualifyingRests.d.ts +0 -0
- /package/dist/{duty → workforce}/validate/index.d.ts +0 -0
- /package/dist/{duty → workforce}/validate/index.js +0 -0
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { Temporal } from "
|
|
1
|
+
import { Temporal } from "./temporal.js";
|
|
2
2
|
import { resolveLocal } from "../instant/convert/resolveLocal.js";
|
|
3
3
|
import { isValidDate } from "../plain/validate/isValidDate.js";
|
|
4
4
|
import { isValidTime } from "../plain/validate/isValidTime.js";
|
|
5
5
|
import { parseBusinessCalendar, parseHolidays } from "./businessCalendar.js";
|
|
6
|
+
import { epochDayOfDate, hasEpochDay, ISO_WEEKDAYS, isoWeekdayOf, lowerBound, } from "./epochDay.js";
|
|
6
7
|
import { coalesceIntervalNanoseconds, } from "./intervalNanoseconds.js";
|
|
8
|
+
import { MAX_EPOCH_NANOSECONDS, MIN_EPOCH_NANOSECONDS, } from "./epochNanoseconds.js";
|
|
7
9
|
import { isObject, isOptionsArgument } from "./isObject.js";
|
|
10
|
+
import { NANOSECONDS_PER_DAY } from "./foreignEpochs.js";
|
|
11
|
+
import { ensureTimeline, offsetOf, offsetTimeline, resolveWallNs, startOfDayNs, } from "./offsetTimeline.js";
|
|
8
12
|
import { nextZonedBucketStart, zonedUnitStart } from "./zonedBucket.js";
|
|
9
13
|
import { frameEpochNanoseconds, frameWallClock, frameZoned, zoneFrame, } from "./zoneFrame.js";
|
|
10
14
|
const DISAMBIGUATIONS = [
|
|
@@ -19,7 +23,7 @@ const WEEKDAY_KEYS = ["1", "2", "3", "4", "5", "6", "7"];
|
|
|
19
23
|
* same bound `bucketRange` puts on a day walk. A walk that runs out answers with the sentinel,
|
|
20
24
|
* never a partial list.
|
|
21
25
|
*/
|
|
22
|
-
|
|
26
|
+
const MAX_SCHEDULE_DAYS = 10_000;
|
|
23
27
|
/**
|
|
24
28
|
* Day buckets one walk may step through: the lookback, the dates, the one date past them that
|
|
25
29
|
* settles the last, and the extra bucket a fall-back into the previous date opens. The date
|
|
@@ -33,20 +37,21 @@ const MAX_SCHEDULE_BUCKETS = 2 * MAX_SCHEDULE_DAYS;
|
|
|
33
37
|
* still be open. Three days clears that with room to spare.
|
|
34
38
|
*/
|
|
35
39
|
const LOOKBACK_NANOSECONDS = 259200000000000n;
|
|
36
|
-
/** TC39 `nsMinInstant` and `nsMaxInstant`: ±10^8 days from the epoch. */
|
|
37
|
-
const MIN_INSTANT_NANOSECONDS = -8640000000000000000000n;
|
|
38
|
-
const MAX_INSTANT_NANOSECONDS = 8640000000000000000000n;
|
|
39
40
|
/**
|
|
40
41
|
* Where an edge whose wall time lies past Temporal's range resolves: just outside it. Such an
|
|
41
42
|
* edge has no string, so it is only ever clipped to a range or compared, never returned.
|
|
42
43
|
*/
|
|
43
|
-
const PAST_LAST_INSTANT =
|
|
44
|
-
const BEFORE_FIRST_INSTANT =
|
|
44
|
+
const PAST_LAST_INSTANT = MAX_EPOCH_NANOSECONDS + 1n;
|
|
45
|
+
const BEFORE_FIRST_INSTANT = MIN_EPOCH_NANOSECONDS - 1n;
|
|
45
46
|
/**
|
|
46
47
|
* The search horizon of `nextOpenAt`, `nextCloseAt` and `addOperatingTime` when the caller
|
|
47
48
|
* gives no `within`: one calendar year in the schedule's zone.
|
|
48
49
|
*/
|
|
49
|
-
|
|
50
|
+
const DEFAULT_OPERATING_HORIZON = "P1Y";
|
|
51
|
+
/** Nanoseconds from midnight to a wall-clock time. */
|
|
52
|
+
function timeOfDayNanoseconds(time) {
|
|
53
|
+
return BigInt(new Temporal.PlainTime().until(time).total("nanoseconds"));
|
|
54
|
+
}
|
|
50
55
|
function parseWindow(value) {
|
|
51
56
|
if (!isObject(value) || Array.isArray(value)) {
|
|
52
57
|
return null;
|
|
@@ -63,6 +68,8 @@ function parseWindow(value) {
|
|
|
63
68
|
return {
|
|
64
69
|
from: fromTime.toString(),
|
|
65
70
|
to: toTime.toString(),
|
|
71
|
+
fromNs: timeOfDayNanoseconds(fromTime),
|
|
72
|
+
toNs: timeOfDayNanoseconds(toTime),
|
|
66
73
|
wraps: Temporal.PlainTime.compare(toTime, fromTime) <= 0,
|
|
67
74
|
};
|
|
68
75
|
}
|
|
@@ -116,7 +123,7 @@ export function parseWeeklyPattern(value) {
|
|
|
116
123
|
/** `holidays` as a date list or a `BusinessCalendar` (only its `holidays` are read). */
|
|
117
124
|
function parseScheduleHolidays(value) {
|
|
118
125
|
if (value === undefined) {
|
|
119
|
-
return new
|
|
126
|
+
return new Int32Array(0);
|
|
120
127
|
}
|
|
121
128
|
if (Array.isArray(value)) {
|
|
122
129
|
return parseHolidays(value);
|
|
@@ -132,23 +139,29 @@ function parseOverrides(value) {
|
|
|
132
139
|
}
|
|
133
140
|
const overrides = new Map();
|
|
134
141
|
for (const candidate of value) {
|
|
135
|
-
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
const { date, windows } = candidate;
|
|
139
|
-
if (typeof date !== "string" || !isValidDate(date)) {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
const key = Temporal.PlainDate.from(date).toString();
|
|
143
|
-
const parsed = parseWindows(windows);
|
|
142
|
+
const entry = parseOverride(candidate);
|
|
144
143
|
// Two overrides for one date say two different things about it.
|
|
145
|
-
if (
|
|
144
|
+
if (entry === null || overrides.has(entry[0])) {
|
|
146
145
|
return null;
|
|
147
146
|
}
|
|
148
|
-
overrides.set(
|
|
147
|
+
overrides.set(entry[0], entry[1]);
|
|
149
148
|
}
|
|
150
149
|
return overrides;
|
|
151
150
|
}
|
|
151
|
+
/** One override as its epoch day and windows, or `null` when it is malformed. */
|
|
152
|
+
function parseOverride(candidate) {
|
|
153
|
+
if (!isObject(candidate) || Array.isArray(candidate)) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
const { date, windows } = candidate;
|
|
157
|
+
if (typeof date !== "string" || !isValidDate(date)) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
// `isValidDate` accepts only the ISO calendar, so the date has an epoch day.
|
|
161
|
+
const key = epochDayOfDate(Temporal.PlainDate.from(date));
|
|
162
|
+
const parsed = parseWindows(windows);
|
|
163
|
+
return parsed === null ? null : [key, parsed];
|
|
164
|
+
}
|
|
152
165
|
/** Validate an `OperatingSchedule`, or `null` when any part of it is malformed. */
|
|
153
166
|
export function parseOperatingSchedule(value) {
|
|
154
167
|
if (!isObject(value) || Array.isArray(value)) {
|
|
@@ -173,8 +186,17 @@ export function parseOperatingSchedule(value) {
|
|
|
173
186
|
weekly: weeklyWindows,
|
|
174
187
|
holidays: holidayDates,
|
|
175
188
|
overrides: overrideWindows,
|
|
189
|
+
specials: specialDays(holidayDates, overrideWindows),
|
|
176
190
|
};
|
|
177
191
|
}
|
|
192
|
+
/** The sorted union of the holiday days and the override days. */
|
|
193
|
+
function specialDays(holidays, overrides) {
|
|
194
|
+
const days = new Set(holidays);
|
|
195
|
+
for (const day of overrides.keys()) {
|
|
196
|
+
days.add(day);
|
|
197
|
+
}
|
|
198
|
+
return Int32Array.from(days).sort();
|
|
199
|
+
}
|
|
178
200
|
/**
|
|
179
201
|
* Read `disambiguation` from an options argument. Omitted means `"compatible"`, as in
|
|
180
202
|
* `resolveLocal`; anything but the four Temporal values, or an options argument that is not an
|
|
@@ -230,13 +252,13 @@ function clampedToRange(instant) {
|
|
|
230
252
|
const nanoseconds = instant();
|
|
231
253
|
// At a seconds offset west of UTC the instant is later than the stand-in it was computed
|
|
232
254
|
// on (`frameZoned`), so it can pass the last instant without Temporal throwing.
|
|
233
|
-
return nanoseconds >
|
|
234
|
-
?
|
|
255
|
+
return nanoseconds > MAX_EPOCH_NANOSECONDS
|
|
256
|
+
? MAX_EPOCH_NANOSECONDS
|
|
235
257
|
: nanoseconds;
|
|
236
258
|
}
|
|
237
259
|
catch (error) {
|
|
238
260
|
if (error instanceof RangeError) {
|
|
239
|
-
return
|
|
261
|
+
return MAX_EPOCH_NANOSECONDS;
|
|
240
262
|
}
|
|
241
263
|
throw error;
|
|
242
264
|
}
|
|
@@ -277,7 +299,7 @@ function dateLimit(schedule, fromNs, days) {
|
|
|
277
299
|
*/
|
|
278
300
|
function firstWalkBucket(schedule, fromNs) {
|
|
279
301
|
const shift = schedule.frame.shiftNanoseconds;
|
|
280
|
-
const earliestNs = shift < 0n ?
|
|
302
|
+
const earliestNs = shift < 0n ? MIN_EPOCH_NANOSECONDS - shift : MIN_EPOCH_NANOSECONDS;
|
|
281
303
|
if (fromNs < earliestNs) {
|
|
282
304
|
throw new RangeError("the instant is before the first the frame can place");
|
|
283
305
|
}
|
|
@@ -294,14 +316,19 @@ function firstWalkBucket(schedule, fromNs) {
|
|
|
294
316
|
throw error;
|
|
295
317
|
}
|
|
296
318
|
}
|
|
297
|
-
/** The windows that apply on
|
|
298
|
-
function
|
|
299
|
-
const
|
|
300
|
-
const override = schedule.overrides.get(key);
|
|
319
|
+
/** The windows that apply on an epoch day: an override, else nothing on a holiday, else the weekday's. */
|
|
320
|
+
function windowsOnDay(schedule, epochDay) {
|
|
321
|
+
const override = schedule.overrides.get(epochDay);
|
|
301
322
|
if (override !== undefined) {
|
|
302
323
|
return override;
|
|
303
324
|
}
|
|
304
|
-
return schedule.holidays
|
|
325
|
+
return hasEpochDay(schedule.holidays, epochDay)
|
|
326
|
+
? []
|
|
327
|
+
: schedule.weekly[isoWeekdayOf(epochDay)];
|
|
328
|
+
}
|
|
329
|
+
/** The windows that apply on `date`. */
|
|
330
|
+
function windowsOn(schedule, date) {
|
|
331
|
+
return windowsOnDay(schedule, epochDayOfDate(date));
|
|
305
332
|
}
|
|
306
333
|
/**
|
|
307
334
|
* Resolve one window edge with `resolveLocal`. An edge on a date Temporal cannot hold is already
|
|
@@ -350,6 +377,22 @@ function dateBefore(date) {
|
|
|
350
377
|
throw error;
|
|
351
378
|
}
|
|
352
379
|
}
|
|
380
|
+
/** The widest span a window with an unresolved edge could cover: its start `"earlier"`, its end `"later"`. */
|
|
381
|
+
function widestSpan(startEdge, endEdge, timeZone) {
|
|
382
|
+
// "earlier" and "later" always resolve, so the widest span is always known.
|
|
383
|
+
return {
|
|
384
|
+
start: resolveEdge(startEdge, timeZone, "earlier")?.ns ?? BEFORE_FIRST_INSTANT,
|
|
385
|
+
end: resolveEdge(endEdge, timeZone, "later")?.ns ?? PAST_LAST_INSTANT,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
/** Where a window ends: its `to` on its own date, or on the next if it wraps midnight. */
|
|
389
|
+
function windowEndEdge(window, date, next) {
|
|
390
|
+
const endDate = window.wraps ? next : date;
|
|
391
|
+
if (endDate !== null) {
|
|
392
|
+
return { date: endDate, time: window.to };
|
|
393
|
+
}
|
|
394
|
+
return window.wraps ? PAST_LAST_INSTANT : BEFORE_FIRST_INSTANT;
|
|
395
|
+
}
|
|
353
396
|
/**
|
|
354
397
|
* Resolve the windows of one local date to instants with `resolveLocal`. Each edge is resolved on
|
|
355
398
|
* its own under `disambiguation`; a wrapping window's `to` is read on the next date. An edge pair
|
|
@@ -375,22 +418,11 @@ function resolveDateWindows(schedule, windows, date, next, disambiguation) {
|
|
|
375
418
|
const { timeZone } = schedule;
|
|
376
419
|
for (const window of windows) {
|
|
377
420
|
const startEdge = date === null ? BEFORE_FIRST_INSTANT : { date, time: window.from };
|
|
378
|
-
const
|
|
379
|
-
const endEdge = endDate === null
|
|
380
|
-
? window.wraps
|
|
381
|
-
? PAST_LAST_INSTANT
|
|
382
|
-
: BEFORE_FIRST_INSTANT
|
|
383
|
-
: { date: endDate, time: window.to };
|
|
421
|
+
const endEdge = windowEndEdge(window, date, next);
|
|
384
422
|
const start = resolveEdge(startEdge, timeZone, disambiguation);
|
|
385
423
|
const end = resolveEdge(endEdge, timeZone, disambiguation);
|
|
386
424
|
if (start === undefined || end === undefined) {
|
|
387
|
-
|
|
388
|
-
const earliest = resolveEdge(startEdge, timeZone, "earlier");
|
|
389
|
-
const latest = resolveEdge(endEdge, timeZone, "later");
|
|
390
|
-
unresolved.push({
|
|
391
|
-
start: earliest?.ns ?? BEFORE_FIRST_INSTANT,
|
|
392
|
-
end: latest?.ns ?? PAST_LAST_INSTANT,
|
|
393
|
-
});
|
|
425
|
+
unresolved.push(widestSpan(startEdge, endEdge, timeZone));
|
|
394
426
|
continue;
|
|
395
427
|
}
|
|
396
428
|
if (start.ns < end.ns) {
|
|
@@ -436,6 +468,55 @@ function resolveVisit(schedule, date, carryIn, disambiguation) {
|
|
|
436
468
|
unresolved: [...before.unresolved, ...own.unresolved],
|
|
437
469
|
};
|
|
438
470
|
}
|
|
471
|
+
/** The state a walk shares between the two ways of reaching dates: pending runs and the bound. */
|
|
472
|
+
function startWalk(fromNs, visitor) {
|
|
473
|
+
let pending = [];
|
|
474
|
+
let unresolvedStart;
|
|
475
|
+
let bound;
|
|
476
|
+
const finish = () => ({ unresolvedStart });
|
|
477
|
+
const flush = () => {
|
|
478
|
+
for (const run of pending) {
|
|
479
|
+
if (visitor.run(run)) {
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return finish();
|
|
484
|
+
};
|
|
485
|
+
return {
|
|
486
|
+
flush,
|
|
487
|
+
/**
|
|
488
|
+
* Hand the visitor the runs no later window can extend, and announce the bound. Returns the
|
|
489
|
+
* walk's result when the visitor stops it, else `undefined`.
|
|
490
|
+
*/
|
|
491
|
+
settle() {
|
|
492
|
+
if (bound === undefined) {
|
|
493
|
+
return undefined;
|
|
494
|
+
}
|
|
495
|
+
const settleBefore = bound;
|
|
496
|
+
for (const run of pending) {
|
|
497
|
+
if (run.end >= settleBefore) {
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
if (visitor.run(run)) {
|
|
501
|
+
return finish();
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
pending = pending.filter((run) => run.end >= settleBefore);
|
|
505
|
+
return visitor.day(settleBefore, pending) ? flush() : undefined;
|
|
506
|
+
},
|
|
507
|
+
/** Take a date's windows; `start` is the first instant of the date. */
|
|
508
|
+
add(resolved, start) {
|
|
509
|
+
for (const window of resolved.unresolved) {
|
|
510
|
+
if (window.end > fromNs &&
|
|
511
|
+
(unresolvedStart === undefined || window.start < unresolvedStart)) {
|
|
512
|
+
unresolvedStart = window.start;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
pending = coalesceIntervalNanoseconds([...pending, ...resolved.records]);
|
|
516
|
+
bound = start;
|
|
517
|
+
},
|
|
518
|
+
};
|
|
519
|
+
}
|
|
439
520
|
/**
|
|
440
521
|
* Walk the schedule's local dates from a little before `fromNs`, handing the visitor each open
|
|
441
522
|
* run as soon as no later window can extend it.
|
|
@@ -455,18 +536,17 @@ function resolveVisit(schedule, date, carryIn, disambiguation) {
|
|
|
455
536
|
* is refused up front past `MAX_SCHEDULE_DAYS` dates, and a search's horizon ends with the
|
|
456
537
|
* `MAX_SCHEDULE_DAYS`th date, so its walk stops by the horizon one date later.
|
|
457
538
|
*/
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
};
|
|
539
|
+
function walkSchedule(schedule, fromNs, disambiguation, visitor, timeline) {
|
|
540
|
+
return walkNearsLimits(fromNs)
|
|
541
|
+
? walkScheduleByBuckets(schedule, fromNs, disambiguation, visitor)
|
|
542
|
+
: walkScheduleByDays(schedule, fromNs, disambiguation, visitor, timeline);
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* `walkSchedule` date by date through Temporal, for a walk that could come near Temporal's limits,
|
|
546
|
+
* where every date, bucket and wall time keeps the range rules (`resolveEdge`).
|
|
547
|
+
*/
|
|
548
|
+
function walkScheduleByBuckets(schedule, fromNs, disambiguation, visitor) {
|
|
549
|
+
const walk = startWalk(fromNs, visitor);
|
|
470
550
|
// The span a range or search may cover, plus the date after its last, which is resolved to
|
|
471
551
|
// settle it because its windows can start before its own first instant.
|
|
472
552
|
const limitDate = dateLimit(schedule, fromNs, MAX_SCHEDULE_DAYS + 2);
|
|
@@ -475,73 +555,159 @@ export function walkSchedule(schedule, fromNs, disambiguation, visitor) {
|
|
|
475
555
|
// True until the first date is resolved, for a walk from the start of the range.
|
|
476
556
|
let carryIn = first.atRangeStart;
|
|
477
557
|
let lastDate = null;
|
|
478
|
-
let bound;
|
|
479
558
|
for (let bucket = 0; bucket < MAX_SCHEDULE_BUCKETS; bucket++) {
|
|
480
559
|
if (current === null) {
|
|
481
560
|
return null;
|
|
482
561
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
if (run.end >= settleBefore) {
|
|
487
|
-
break;
|
|
488
|
-
}
|
|
489
|
-
if (visitor.run(run)) {
|
|
490
|
-
return finish();
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
pending = pending.filter((run) => run.end >= settleBefore);
|
|
494
|
-
if (visitor.day(settleBefore, pending)) {
|
|
495
|
-
return flush();
|
|
496
|
-
}
|
|
562
|
+
const stopped = walk.settle();
|
|
563
|
+
if (stopped !== undefined) {
|
|
564
|
+
return stopped;
|
|
497
565
|
}
|
|
498
566
|
const date = current.toPlainDate();
|
|
499
567
|
// A fall-back that re-enters the previous date opens a second bucket for it; its windows
|
|
500
568
|
// were already resolved on the first visit.
|
|
501
569
|
if (lastDate === null || Temporal.PlainDate.compare(date, lastDate) > 0) {
|
|
502
|
-
if (limitDate
|
|
503
|
-
Temporal.PlainDate.compare(date, limitDate) >= 0) {
|
|
570
|
+
if (isFromDate(date, limitDate)) {
|
|
504
571
|
return null;
|
|
505
572
|
}
|
|
506
573
|
const resolved = resolveVisit(schedule, date, carryIn, disambiguation);
|
|
507
574
|
carryIn = false;
|
|
508
|
-
for (const window of resolved.unresolved) {
|
|
509
|
-
if (window.end > fromNs &&
|
|
510
|
-
(unresolvedStart === undefined || window.start < unresolvedStart)) {
|
|
511
|
-
unresolvedStart = window.start;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
pending = coalesceIntervalNanoseconds([...pending, ...resolved.records]);
|
|
515
575
|
lastDate = date;
|
|
516
|
-
|
|
576
|
+
walk.add(resolved, frameEpochNanoseconds(current, schedule.frame));
|
|
517
577
|
}
|
|
518
|
-
|
|
519
|
-
|
|
578
|
+
const following = nextDayBucket(current);
|
|
579
|
+
// The next day starts past Temporal's last instant: nothing more can open.
|
|
580
|
+
if (following === undefined) {
|
|
581
|
+
return walk.flush();
|
|
520
582
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
583
|
+
current = following;
|
|
584
|
+
}
|
|
585
|
+
return null;
|
|
586
|
+
}
|
|
587
|
+
/** True when `date` is `limit` or later; never when there is no limit. */
|
|
588
|
+
function isFromDate(date, limit) {
|
|
589
|
+
return limit !== null && Temporal.PlainDate.compare(date, limit) >= 0;
|
|
590
|
+
}
|
|
591
|
+
/** The bucket of the next day, or `undefined` when it starts past Temporal's last instant. */
|
|
592
|
+
function nextDayBucket(current) {
|
|
593
|
+
try {
|
|
594
|
+
return nextZonedBucketStart(current, "day");
|
|
595
|
+
}
|
|
596
|
+
catch (error) {
|
|
597
|
+
if (error instanceof RangeError) {
|
|
598
|
+
return undefined;
|
|
527
599
|
}
|
|
600
|
+
throw error;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Walk dates as epoch days read from the offset timeline, without a `ZonedDateTime` per date.
|
|
605
|
+
* Same contract as `walkScheduleByBuckets`, for a walk that stays clear of Temporal's limits.
|
|
606
|
+
* `shared` is a timeline a caller already built that reaches at least nine days before `fromNs`,
|
|
607
|
+
* so pieces of one range read the zone's offset changes once.
|
|
608
|
+
* Dates ascend and are visited once: a date whose first instant is the next date's (a deleted
|
|
609
|
+
* date, `Pacific/Apia` 2011-12-30) is skipped, and a re-entered date (`America/Goose_Bay`
|
|
610
|
+
* 2010-11-06) is one date.
|
|
611
|
+
*/
|
|
612
|
+
function walkScheduleByDays(schedule, fromNs, disambiguation, visitor, shared) {
|
|
613
|
+
const walk = startWalk(fromNs, visitor);
|
|
614
|
+
const startNs = fromNs - LOOKBACK_NANOSECONDS;
|
|
615
|
+
const timeline = shared ??
|
|
616
|
+
offsetTimeline(schedule.frame, startNs - 6n * NANOSECONDS_PER_DAY, startNs + 14n * NANOSECONDS_PER_DAY);
|
|
617
|
+
const limitDay = localDayOf(timeline, fromNs) + MAX_SCHEDULE_DAYS + 2;
|
|
618
|
+
let day = localDayOf(timeline, startNs);
|
|
619
|
+
for (let count = 0; count < MAX_SCHEDULE_BUCKETS; count++, day++) {
|
|
620
|
+
ensureTimeline(timeline, BigInt(day + 6) * NANOSECONDS_PER_DAY);
|
|
621
|
+
const start = startOfDayNs(timeline, day);
|
|
622
|
+
if (start === startOfDayNs(timeline, day + 1)) {
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
const stopped = walk.settle();
|
|
626
|
+
if (stopped !== undefined) {
|
|
627
|
+
return stopped;
|
|
628
|
+
}
|
|
629
|
+
if (day >= limitDay) {
|
|
630
|
+
return null;
|
|
631
|
+
}
|
|
632
|
+
walk.add(resolveDayWindows(windowsOnDay(schedule, day), timeline, day, disambiguation), start);
|
|
528
633
|
}
|
|
529
634
|
return null;
|
|
530
635
|
}
|
|
636
|
+
/** The local epoch day `ns` falls on in the timeline's frame. */
|
|
637
|
+
function localDayOf(timeline, ns) {
|
|
638
|
+
return Number(floorDivide(ns + offsetOf(timeline, ns), NANOSECONDS_PER_DAY));
|
|
639
|
+
}
|
|
640
|
+
/** `resolveDateWindows` for a date well inside Temporal's range, read from the timeline. */
|
|
641
|
+
function resolveDayWindows(windows, timeline, day, disambiguation) {
|
|
642
|
+
const records = [];
|
|
643
|
+
const unresolved = [];
|
|
644
|
+
const midnight = BigInt(day) * NANOSECONDS_PER_DAY;
|
|
645
|
+
for (const window of windows) {
|
|
646
|
+
const startWall = midnight + window.fromNs;
|
|
647
|
+
const endWall = (window.wraps ? midnight + NANOSECONDS_PER_DAY : midnight) + window.toNs;
|
|
648
|
+
const start = resolveWallNs(timeline, startWall, disambiguation);
|
|
649
|
+
const end = resolveWallNs(timeline, endWall, disambiguation);
|
|
650
|
+
if (start === undefined || end === undefined) {
|
|
651
|
+
unresolved.push({
|
|
652
|
+
start: resolveWallNs(timeline, startWall, "earlier") ?? BEFORE_FIRST_INSTANT,
|
|
653
|
+
end: resolveWallNs(timeline, endWall, "later") ?? PAST_LAST_INSTANT,
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
else if (start < end) {
|
|
657
|
+
// The text of an edge is written when a run is returned (`runText`).
|
|
658
|
+
records.push({ start, end, startText: "", endText: "" });
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
return { records, unresolved };
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Days either side of Temporal's range that the closed forms and the date walk keep clear of;
|
|
665
|
+
* a walk that could come nearer takes the date-by-date path, which reads the limits itself.
|
|
666
|
+
*/
|
|
667
|
+
const LIMIT_MARGIN = 30n * NANOSECONDS_PER_DAY;
|
|
668
|
+
/** True when a walk from `fromNs` could reach within `LIMIT_MARGIN` of Temporal's range. */
|
|
669
|
+
function walkNearsLimits(fromNs) {
|
|
670
|
+
return (fromNs - LOOKBACK_NANOSECONDS - LIMIT_MARGIN < MIN_EPOCH_NANOSECONDS ||
|
|
671
|
+
fromNs +
|
|
672
|
+
BigInt(MAX_SCHEDULE_DAYS + 3) * NANOSECONDS_PER_DAY +
|
|
673
|
+
LIMIT_MARGIN >
|
|
674
|
+
MAX_EPOCH_NANOSECONDS);
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* True when a range spans more than MAX_SCHEDULE_DAYS local dates: it is refused before walking.
|
|
678
|
+
* Walking thousands of dates only to return the sentinel took seconds.
|
|
679
|
+
*/
|
|
680
|
+
function spansTooManyDates(schedule, range) {
|
|
681
|
+
const lastInstant = range.end > range.start ? range.end - 1n : range.end;
|
|
682
|
+
const limit = dateLimit(schedule, range.start, MAX_SCHEDULE_DAYS);
|
|
683
|
+
return (limit !== null &&
|
|
684
|
+
Temporal.PlainDate.compare(localDateOf(schedule, lastInstant), limit) >= 0);
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* The text of a run's edges: the range's own where the run was clipped to it, else the instant's
|
|
688
|
+
* UTC string, written here and only for the runs a caller returns.
|
|
689
|
+
*/
|
|
690
|
+
export function runText(run) {
|
|
691
|
+
return {
|
|
692
|
+
start: run.startText === "" ? instantText(run.start) : run.startText,
|
|
693
|
+
end: run.endText === "" ? instantText(run.end) : run.endText,
|
|
694
|
+
};
|
|
695
|
+
}
|
|
531
696
|
/**
|
|
532
697
|
* The schedule's open runs clipped to `[startNs, endNs)`, in the range's own strings where a run
|
|
533
698
|
* is clipped. `null` when the walk fails (see `walkSchedule`), or when a window rejected under
|
|
534
699
|
* `"reject"` reaches into the range.
|
|
535
700
|
*/
|
|
536
701
|
export function scheduleRunsWithin(schedule, range, disambiguation) {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
702
|
+
return spansTooManyDates(schedule, range)
|
|
703
|
+
? null
|
|
704
|
+
: walkedRunsWithin(schedule, range, disambiguation);
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* `scheduleRunsWithin` for a range already known to span few enough local dates, as every piece
|
|
708
|
+
* of such a range does: a piece starts no earlier and ends no later, so it cannot reach the limit.
|
|
709
|
+
*/
|
|
710
|
+
function walkedRunsWithin(schedule, range, disambiguation, timeline) {
|
|
545
711
|
const runs = [];
|
|
546
712
|
const walked = walkSchedule(schedule, range.start, disambiguation, {
|
|
547
713
|
run: (run) => {
|
|
@@ -561,7 +727,7 @@ export function scheduleRunsWithin(schedule, range, disambiguation) {
|
|
|
561
727
|
return false;
|
|
562
728
|
},
|
|
563
729
|
day: (bound) => bound >= range.end,
|
|
564
|
-
});
|
|
730
|
+
}, timeline);
|
|
565
731
|
if (walked === null ||
|
|
566
732
|
(walked.unresolvedStart !== undefined && walked.unresolvedStart < range.end)) {
|
|
567
733
|
return null;
|
|
@@ -573,44 +739,50 @@ function later(a, b) {
|
|
|
573
739
|
return a > b ? a : b;
|
|
574
740
|
}
|
|
575
741
|
/**
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
* sooner.
|
|
742
|
+
* Walk from `fromNs` until a caller can answer. `atRun` sees each finished run that ends after
|
|
743
|
+
* `fromNs`, and `atDay` the first pending run that does when no later window can start before
|
|
744
|
+
* `bound`; each returns the answer, or `undefined` to keep walking. Past `horizonNs` the walk
|
|
745
|
+
* stops unanswered. `null` when the walk fails.
|
|
581
746
|
*/
|
|
582
|
-
|
|
747
|
+
function firstAnswer(schedule, fromNs, horizonNs, disambiguation, atRun, atDay) {
|
|
583
748
|
let answer;
|
|
584
749
|
const walked = walkSchedule(schedule, fromNs, disambiguation, {
|
|
585
750
|
run: (run) => {
|
|
586
|
-
if (answer
|
|
587
|
-
|
|
588
|
-
}
|
|
589
|
-
if (run.end <= fromNs) {
|
|
590
|
-
return false;
|
|
751
|
+
if (answer === undefined && run.end > fromNs) {
|
|
752
|
+
answer = atRun(run);
|
|
591
753
|
}
|
|
592
|
-
answer
|
|
593
|
-
return true;
|
|
754
|
+
return answer !== undefined;
|
|
594
755
|
},
|
|
595
756
|
day: (bound, pending) => {
|
|
596
757
|
if (bound > horizonNs) {
|
|
597
758
|
return true;
|
|
598
759
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
answer = later(next.start, fromNs);
|
|
602
|
-
return true;
|
|
603
|
-
}
|
|
604
|
-
return false;
|
|
760
|
+
answer = atDay(bound, pending.find((run) => run.end > fromNs));
|
|
761
|
+
return answer !== undefined;
|
|
605
762
|
},
|
|
606
763
|
});
|
|
764
|
+
return walked === null
|
|
765
|
+
? null
|
|
766
|
+
: { answer, unresolvedStart: walked.unresolvedStart };
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* The first instant at or after `fromNs` that the schedule is open: `fromNs` itself inside an
|
|
770
|
+
* open run, else the start of the next run. Answered as soon as no later window can open
|
|
771
|
+
* sooner, without waiting for the run to close. `undefined` when none falls at or before
|
|
772
|
+
* `horizonNs`, `null` when the walk fails or a window rejected under `"reject"` could open
|
|
773
|
+
* sooner.
|
|
774
|
+
*/
|
|
775
|
+
export function firstOpenInstant(schedule, fromNs, horizonNs, disambiguation) {
|
|
776
|
+
const walked = firstAnswer(schedule, fromNs, horizonNs, disambiguation, (run) => later(run.start, fromNs), (bound, next) => next !== undefined && later(next.start, fromNs) <= bound
|
|
777
|
+
? later(next.start, fromNs)
|
|
778
|
+
: undefined);
|
|
607
779
|
if (walked === null) {
|
|
608
780
|
return null;
|
|
609
781
|
}
|
|
782
|
+
const { answer, unresolvedStart } = walked;
|
|
610
783
|
if (answer === undefined || answer > horizonNs) {
|
|
611
784
|
return undefined;
|
|
612
785
|
}
|
|
613
|
-
const { unresolvedStart } = walked;
|
|
614
786
|
return answer > fromNs &&
|
|
615
787
|
unresolvedStart !== undefined &&
|
|
616
788
|
unresolvedStart < answer
|
|
@@ -624,35 +796,15 @@ export function firstOpenInstant(schedule, fromNs, horizonNs, disambiguation) {
|
|
|
624
796
|
* the walk fails or a window rejected under `"reject"` could keep the schedule open past it.
|
|
625
797
|
*/
|
|
626
798
|
export function firstClosedInstant(schedule, fromNs, horizonNs, disambiguation) {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
}
|
|
633
|
-
if (run.end <= fromNs) {
|
|
634
|
-
return false;
|
|
635
|
-
}
|
|
636
|
-
answer = run.start <= fromNs ? run.end : fromNs;
|
|
637
|
-
return true;
|
|
638
|
-
},
|
|
639
|
-
day: (bound, pending) => {
|
|
640
|
-
if (bound > horizonNs) {
|
|
641
|
-
return true;
|
|
642
|
-
}
|
|
643
|
-
const next = pending.find((run) => run.end > fromNs);
|
|
644
|
-
// Closed at `fromNs`, and every later window starts after it.
|
|
645
|
-
if (fromNs < bound && (next === undefined || next.start > fromNs)) {
|
|
646
|
-
answer = fromNs;
|
|
647
|
-
return true;
|
|
648
|
-
}
|
|
649
|
-
return false;
|
|
650
|
-
},
|
|
651
|
-
});
|
|
799
|
+
const walked = firstAnswer(schedule, fromNs, horizonNs, disambiguation, (run) => (run.start <= fromNs ? run.end : fromNs),
|
|
800
|
+
// Closed at `fromNs`, and every later window starts after it.
|
|
801
|
+
(bound, next) => fromNs < bound && (next === undefined || next.start > fromNs)
|
|
802
|
+
? fromNs
|
|
803
|
+
: undefined);
|
|
652
804
|
if (walked === null) {
|
|
653
805
|
return null;
|
|
654
806
|
}
|
|
655
|
-
const closed = answer ?? fromNs;
|
|
807
|
+
const closed = walked.answer ?? fromNs;
|
|
656
808
|
if (closed > horizonNs) {
|
|
657
809
|
return undefined;
|
|
658
810
|
}
|
|
@@ -672,48 +824,36 @@ export function instantAfterOpenTime(schedule, fromNs, amountNs, horizonNs, disa
|
|
|
672
824
|
if (amountNs === 0n) {
|
|
673
825
|
return fromNs;
|
|
674
826
|
}
|
|
827
|
+
const jump = jumpOverWholeDays(schedule, fromNs, amountNs, horizonNs, disambiguation);
|
|
828
|
+
return walkForOpenTime(schedule, jump?.startNs ?? fromNs, jump?.remaining ?? amountNs, horizonNs, disambiguation);
|
|
829
|
+
}
|
|
830
|
+
/** `instantAfterOpenTime` by walking dates from `fromNs`. */
|
|
831
|
+
function walkForOpenTime(schedule, fromNs, amountNs, horizonNs, disambiguation) {
|
|
675
832
|
let remaining = amountNs;
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
},
|
|
693
|
-
day: (bound, pending) => {
|
|
694
|
-
if (bound > horizonNs) {
|
|
695
|
-
return true;
|
|
696
|
-
}
|
|
697
|
-
// Every pending run ends at or after `bound`, so only the first can hold a deadline at or
|
|
698
|
-
// before it; open time before `bound` is final.
|
|
699
|
-
const next = pending.find((run) => run.end > fromNs);
|
|
700
|
-
if (next !== undefined) {
|
|
701
|
-
const deadline = later(next.start, fromNs) + remaining;
|
|
702
|
-
if (deadline <= next.end && deadline <= bound) {
|
|
703
|
-
answer = deadline;
|
|
704
|
-
return true;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
return false;
|
|
708
|
-
},
|
|
833
|
+
const walked = firstAnswer(schedule, fromNs, horizonNs, disambiguation, (run) => {
|
|
834
|
+
const start = later(run.start, fromNs);
|
|
835
|
+
if (run.end - start >= remaining) {
|
|
836
|
+
return start + remaining;
|
|
837
|
+
}
|
|
838
|
+
remaining -= run.end - start;
|
|
839
|
+
return undefined;
|
|
840
|
+
},
|
|
841
|
+
// Every pending run ends at or after `bound`, so only the first can hold a deadline at or
|
|
842
|
+
// before it; open time before `bound` is final.
|
|
843
|
+
(bound, next) => {
|
|
844
|
+
if (next === undefined) {
|
|
845
|
+
return undefined;
|
|
846
|
+
}
|
|
847
|
+
const deadline = later(next.start, fromNs) + remaining;
|
|
848
|
+
return deadline <= next.end && deadline <= bound ? deadline : undefined;
|
|
709
849
|
});
|
|
710
850
|
if (walked === null) {
|
|
711
851
|
return null;
|
|
712
852
|
}
|
|
853
|
+
const { answer, unresolvedStart } = walked;
|
|
713
854
|
if (answer === undefined || answer > horizonNs) {
|
|
714
855
|
return undefined;
|
|
715
856
|
}
|
|
716
|
-
const { unresolvedStart } = walked;
|
|
717
857
|
return unresolvedStart !== undefined && unresolvedStart < answer
|
|
718
858
|
? null
|
|
719
859
|
: answer;
|
|
@@ -754,3 +894,225 @@ export function parseOpenTimeAmount(value) {
|
|
|
754
894
|
export function instantText(nanoseconds) {
|
|
755
895
|
return Temporal.Instant.fromEpochNanoseconds(nanoseconds).toString();
|
|
756
896
|
}
|
|
897
|
+
/** `a / b` rounded toward negative infinity, for a positive `b`. */
|
|
898
|
+
function floorDivide(a, b) {
|
|
899
|
+
const quotient = a / b;
|
|
900
|
+
return a % b < 0n ? quotient - 1n : quotient;
|
|
901
|
+
}
|
|
902
|
+
/** `a / b` rounded toward positive infinity, for a positive `b`. */
|
|
903
|
+
function ceilDivide(a, b) {
|
|
904
|
+
return -floorDivide(-a, b);
|
|
905
|
+
}
|
|
906
|
+
/** Length of the union of `spans`, each `[start, end)`. */
|
|
907
|
+
function unionLength(spans) {
|
|
908
|
+
spans.sort((x, y) => (x[0] < y[0] ? -1 : x[0] > y[0] ? 1 : 0));
|
|
909
|
+
let total = 0n;
|
|
910
|
+
let reached = 0n;
|
|
911
|
+
for (const [start, end] of spans) {
|
|
912
|
+
const from = start > reached ? start : reached;
|
|
913
|
+
if (end > from) {
|
|
914
|
+
total += end - from;
|
|
915
|
+
reached = end;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
return total;
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Open time inside the day bucket of a quiet date: the tails of the previous date's wrapping
|
|
922
|
+
* windows (`[0, to)`) and the date's own windows (`[from, to)`, or `[from, 1 day)` when wrapping),
|
|
923
|
+
* as a union.
|
|
924
|
+
*/
|
|
925
|
+
function dayCoverage(previous, current) {
|
|
926
|
+
const spans = [];
|
|
927
|
+
for (const window of previous) {
|
|
928
|
+
if (window.wraps) {
|
|
929
|
+
spans.push([0n, window.toNs]);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
for (const window of current) {
|
|
933
|
+
spans.push([
|
|
934
|
+
window.fromNs,
|
|
935
|
+
window.wraps ? NANOSECONDS_PER_DAY : window.toNs,
|
|
936
|
+
]);
|
|
937
|
+
}
|
|
938
|
+
return unionLength(spans);
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* The maximal blocks of quiet dates lying wholly inside `range`, ascending. A date `d` is quiet
|
|
942
|
+
* when one stretch, offset `o`, holds every instant from `(d - 2)` days `- o` to `(d + 3)` days
|
|
943
|
+
* `- o`: every wall time on `d - 1`, `d` and `d + 1` then has the one candidate `wall - o` under
|
|
944
|
+
* every policy, and `d`'s bucket is exactly one day. A refused edge has a change within a day of
|
|
945
|
+
* it, so none reaches a quiet date.
|
|
946
|
+
*/
|
|
947
|
+
function quietBlocks(timeline, range) {
|
|
948
|
+
const { changes, offsets } = timeline;
|
|
949
|
+
const day = NANOSECONDS_PER_DAY;
|
|
950
|
+
const blocks = [];
|
|
951
|
+
for (let index = 0; index < offsets.length; index++) {
|
|
952
|
+
const offset = offsets[index];
|
|
953
|
+
const low = index === 0 ? timeline.fromNs : changes[index - 1];
|
|
954
|
+
const high = index === changes.length ? timeline.toNs : changes[index];
|
|
955
|
+
const first = ceilDivide(low + offset, day) + 2n;
|
|
956
|
+
const last = floorDivide(high - 1n + offset, day) - 3n;
|
|
957
|
+
const insideFirst = ceilDivide(range.start + offset, day);
|
|
958
|
+
const insideLast = floorDivide(range.end + offset, day) - 1n;
|
|
959
|
+
const firstDay = first > insideFirst ? first : insideFirst;
|
|
960
|
+
const lastDay = last < insideLast ? last : insideLast;
|
|
961
|
+
if (firstDay <= lastDay) {
|
|
962
|
+
blocks.push({
|
|
963
|
+
firstDay: Number(firstDay),
|
|
964
|
+
lastDay: Number(lastDay),
|
|
965
|
+
startNs: firstDay * day - offset,
|
|
966
|
+
endNs: (lastDay + 1n) * day - offset,
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
return blocks;
|
|
971
|
+
}
|
|
972
|
+
/** The open time each date adds to the plain week, indexed by ISO weekday (index 0 is unused). */
|
|
973
|
+
function plainWeekCoverage(schedule) {
|
|
974
|
+
const plain = [0n];
|
|
975
|
+
for (let weekday = 1; weekday <= ISO_WEEKDAYS; weekday++) {
|
|
976
|
+
plain.push(dayCoverage(schedule.weekly[weekday === 1 ? ISO_WEEKDAYS : weekday - 1], schedule.weekly[weekday]));
|
|
977
|
+
}
|
|
978
|
+
return plain;
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* What the holiday and override dates of a quiet block change from the plain week. A date differs
|
|
982
|
+
* from it when it or the date before it is a holiday or override.
|
|
983
|
+
*/
|
|
984
|
+
function specialDayCorrection(schedule, block, plain) {
|
|
985
|
+
const { specials } = schedule;
|
|
986
|
+
let total = 0n;
|
|
987
|
+
let handled = block.firstDay - 1;
|
|
988
|
+
for (let index = lowerBound(specials, block.firstDay - 1); index < specials.length && specials[index] <= block.lastDay; index++) {
|
|
989
|
+
for (const day of [specials[index], specials[index] + 1]) {
|
|
990
|
+
if (day > handled && day >= block.firstDay && day <= block.lastDay) {
|
|
991
|
+
total +=
|
|
992
|
+
dayCoverage(windowsOnDay(schedule, day - 1), windowsOnDay(schedule, day)) - plain[isoWeekdayOf(day)];
|
|
993
|
+
handled = day;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
return total;
|
|
998
|
+
}
|
|
999
|
+
/** Open time over the dates of a quiet block, from the weekly pattern and the special days. */
|
|
1000
|
+
function quietBlockOpenTime(schedule, block) {
|
|
1001
|
+
const plain = plainWeekCoverage(schedule);
|
|
1002
|
+
const dates = block.lastDay - block.firstDay + 1;
|
|
1003
|
+
const leftover = dates % ISO_WEEKDAYS;
|
|
1004
|
+
let week = 0n;
|
|
1005
|
+
for (let weekday = 1; weekday <= ISO_WEEKDAYS; weekday++) {
|
|
1006
|
+
week += plain[weekday];
|
|
1007
|
+
}
|
|
1008
|
+
let total = week * BigInt(Math.floor(dates / ISO_WEEKDAYS));
|
|
1009
|
+
for (let offset = 0; offset < leftover; offset++) {
|
|
1010
|
+
total += plain[isoWeekdayOf(block.firstDay + offset)];
|
|
1011
|
+
}
|
|
1012
|
+
return total + specialDayCorrection(schedule, block, plain);
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Open time in `[start, end)` by walking its dates, or `null` as `scheduleRunsWithin` is.
|
|
1016
|
+
* `timeline` is one a caller already built for the pieces of a range.
|
|
1017
|
+
*/
|
|
1018
|
+
function walkedOpenTime(schedule, start, end, disambiguation, timeline) {
|
|
1019
|
+
const runs = walkedRunsWithin(schedule, { start, end, startText: "", endText: "" }, disambiguation, timeline);
|
|
1020
|
+
return runs === null
|
|
1021
|
+
? null
|
|
1022
|
+
: runs.reduce((total, run) => total + (run.end - run.start), 0n);
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Open time in `[range.start, range.end)`, in nanoseconds; `null` exactly when
|
|
1026
|
+
* `scheduleRunsWithin` would be.
|
|
1027
|
+
*
|
|
1028
|
+
* Open time is additive over disjoint half-open pieces. Whole day buckets inside a stretch of
|
|
1029
|
+
* constant offset are summed in closed form (whole weeks of the weekly pattern, plus a correction
|
|
1030
|
+
* for each holiday and override); the pieces between them, the range's ends and the dates near an
|
|
1031
|
+
* offset change, are walked.
|
|
1032
|
+
*/
|
|
1033
|
+
export function openTimeWithin(schedule, range, disambiguation) {
|
|
1034
|
+
if (spansTooManyDates(schedule, range)) {
|
|
1035
|
+
return null;
|
|
1036
|
+
}
|
|
1037
|
+
let total = 0n;
|
|
1038
|
+
let cursor = range.start;
|
|
1039
|
+
let timeline;
|
|
1040
|
+
if (!walkNearsLimits(range.start)) {
|
|
1041
|
+
timeline = offsetTimeline(schedule.frame, range.start - 12n * NANOSECONDS_PER_DAY, range.end + 6n * NANOSECONDS_PER_DAY);
|
|
1042
|
+
for (const block of quietBlocks(timeline, range)) {
|
|
1043
|
+
const piece = walkedOpenTime(schedule, cursor, block.startNs, disambiguation, timeline);
|
|
1044
|
+
if (piece === null) {
|
|
1045
|
+
return null;
|
|
1046
|
+
}
|
|
1047
|
+
total += piece + quietBlockOpenTime(schedule, block);
|
|
1048
|
+
cursor = block.endNs;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
const last = walkedOpenTime(schedule, cursor, range.end, disambiguation, timeline);
|
|
1052
|
+
return last === null ? null : total + last;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Where `instantAfterOpenTime` can start walking: the first instant of the latest local date
|
|
1056
|
+
* whose start still has less than `amountNs` of open time before it, and the open time left after
|
|
1057
|
+
* that. A date that starts at or before `fromNs` (a fall-back repeats local midnight) starts at
|
|
1058
|
+
* `fromNs` instead, with nothing counted before it: counting from an earlier start would add open
|
|
1059
|
+
* time that precedes `fromNs`. Equal by additivity: the answer `X` has
|
|
1060
|
+
* `open[fromNs, X) = amountNs`, so it lies after that start. `undefined` when no date qualifies, when the walk could near Temporal's limits, or
|
|
1061
|
+
* when `openTimeWithin` is `null` (a window refused under `"reject"`): the walk then starts at
|
|
1062
|
+
* `fromNs`.
|
|
1063
|
+
*/
|
|
1064
|
+
function jumpOverWholeDays(schedule, fromNs, amountNs, horizonNs, disambiguation) {
|
|
1065
|
+
if (walkNearsLimits(fromNs)) {
|
|
1066
|
+
return undefined;
|
|
1067
|
+
}
|
|
1068
|
+
const timeline = offsetTimeline(schedule.frame, fromNs - 6n * NANOSECONDS_PER_DAY, fromNs + 14n * NANOSECONDS_PER_DAY);
|
|
1069
|
+
const firstDay = localDayOf(timeline, fromNs);
|
|
1070
|
+
const lastDay = localDayOf(timeline, horizonNs);
|
|
1071
|
+
// The open time before the start of `day`: below `amountNs`, or not (`undefined`: `null`).
|
|
1072
|
+
const before = (day) => {
|
|
1073
|
+
ensureTimeline(timeline, BigInt(day + 6) * NANOSECONDS_PER_DAY);
|
|
1074
|
+
const dayStart = startOfDayNs(timeline, day);
|
|
1075
|
+
const startNs = dayStart > fromNs ? dayStart : fromNs;
|
|
1076
|
+
const open = openTimeWithin(schedule, { start: fromNs, end: startNs, startText: "", endText: "" }, disambiguation);
|
|
1077
|
+
return open === null ? undefined : [startNs, open];
|
|
1078
|
+
};
|
|
1079
|
+
const found = latestDayBelow(firstDay, lastDay, amountNs, before);
|
|
1080
|
+
if (found === undefined) {
|
|
1081
|
+
return undefined;
|
|
1082
|
+
}
|
|
1083
|
+
return { startNs: found.startNs, remaining: amountNs - found.open };
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* The latest date in `(firstDay, lastDay]` whose probe reads less than `amountNs`: gallop away
|
|
1087
|
+
* from `firstDay`, then bisect between the last date below and the first not. `undefined` when
|
|
1088
|
+
* there is none or a probe is `undefined`.
|
|
1089
|
+
*/
|
|
1090
|
+
function latestDayBelow(firstDay, lastDay, amountNs, before) {
|
|
1091
|
+
let good;
|
|
1092
|
+
let bad = lastDay + 1;
|
|
1093
|
+
for (let step = 1; firstDay + step <= lastDay; step *= 2) {
|
|
1094
|
+
const probed = before(firstDay + step);
|
|
1095
|
+
if (probed === undefined) {
|
|
1096
|
+
return undefined;
|
|
1097
|
+
}
|
|
1098
|
+
if (probed[1] >= amountNs) {
|
|
1099
|
+
bad = firstDay + step;
|
|
1100
|
+
break;
|
|
1101
|
+
}
|
|
1102
|
+
good = { day: firstDay + step, startNs: probed[0], open: probed[1] };
|
|
1103
|
+
}
|
|
1104
|
+
while (good !== undefined && bad - good.day > 1) {
|
|
1105
|
+
const middle = good.day + Math.floor((bad - good.day) / 2);
|
|
1106
|
+
const probed = before(middle);
|
|
1107
|
+
if (probed === undefined) {
|
|
1108
|
+
return undefined;
|
|
1109
|
+
}
|
|
1110
|
+
if (probed[1] >= amountNs) {
|
|
1111
|
+
bad = middle;
|
|
1112
|
+
}
|
|
1113
|
+
else {
|
|
1114
|
+
good = { day: middle, startNs: probed[0], open: probed[1] };
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return good;
|
|
1118
|
+
}
|