@northguild/gmt 1.19.0 → 1.21.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 +68 -29
- package/dist/calendar/business/businessDaysBetween.d.ts +5 -4
- package/dist/calendar/business/businessDaysBetween.js +58 -87
- package/dist/calendar/business/index.d.ts +11 -7
- package/dist/calendar/business/index.js +10 -10
- package/dist/calendar/business/mergeCalendars.d.ts +4 -3
- package/dist/calendar/business/mergeCalendars.js +56 -65
- package/dist/calendar/business/nextBusinessDay.d.ts +5 -4
- package/dist/calendar/business/nextBusinessDay.js +37 -36
- package/dist/calendar/business/previousBusinessDay.d.ts +5 -4
- package/dist/calendar/business/previousBusinessDay.js +37 -36
- package/dist/calendar/business/rollDate.d.ts +7 -5
- package/dist/calendar/business/rollDate.js +77 -114
- package/dist/calendar/calculate/bucketRange.d.ts +12 -11
- package/dist/calendar/calculate/bucketRange.js +105 -119
- package/dist/calendar/calculate/floorToZone.d.ts +5 -4
- package/dist/calendar/calculate/floorToZone.js +68 -68
- package/dist/calendar/calculate/getFiscalPeriod.d.ts +63 -52
- package/dist/calendar/calculate/getFiscalPeriod.js +106 -93
- package/dist/calendar/calculate/getIsoWeekDate.d.ts +13 -13
- package/dist/calendar/calculate/getIsoWeekDate.js +41 -35
- package/dist/calendar/calculate/getOrdinalDate.d.ts +11 -11
- package/dist/calendar/calculate/getOrdinalDate.js +31 -25
- package/dist/calendar/calculate/getQuarter.d.ts +36 -30
- package/dist/calendar/calculate/getQuarter.js +71 -53
- package/dist/calendar/calculate/index.d.ts +7 -6
- package/dist/calendar/calculate/index.js +8 -6
- package/dist/calendar/hours/addOperatingTime.d.ts +25 -23
- package/dist/calendar/hours/addOperatingTime.js +57 -63
- package/dist/calendar/hours/index.d.ts +8 -7
- package/dist/calendar/hours/index.js +9 -7
- package/dist/calendar/hours/isOpenAt.d.ts +17 -15
- package/dist/calendar/hours/isOpenAt.js +47 -48
- package/dist/calendar/hours/nextCloseAt.d.ts +24 -22
- package/dist/calendar/hours/nextCloseAt.js +52 -55
- package/dist/calendar/hours/nextOpenAt.d.ts +25 -23
- package/dist/calendar/hours/nextOpenAt.js +48 -51
- package/dist/calendar/hours/operatingIntervals.d.ts +16 -13
- package/dist/calendar/hours/operatingIntervals.js +52 -55
- package/dist/calendar/hours/operatingTimeBetween.d.ts +16 -14
- package/dist/calendar/hours/operatingTimeBetween.js +53 -52
- package/dist/calendar/hours/recurringWindows.d.ts +19 -16
- package/dist/calendar/hours/recurringWindows.js +81 -86
- package/dist/calendar/index.d.ts +41 -5
- package/dist/calendar/index.js +37 -6
- package/dist/calendar/rules/buildBusinessCalendar.d.ts +27 -0
- package/dist/calendar/rules/buildBusinessCalendar.js +68 -0
- package/dist/calendar/rules/easterSunday.d.ts +31 -0
- package/dist/calendar/rules/easterSunday.js +41 -0
- package/dist/calendar/rules/holidayDates.d.ts +38 -0
- package/dist/calendar/rules/holidayDates.js +63 -0
- package/dist/calendar/rules/index.d.ts +6 -0
- package/dist/calendar/rules/index.js +7 -0
- package/dist/calendar/rules/nthWeekdayOfMonth.d.ts +24 -0
- package/dist/calendar/rules/nthWeekdayOfMonth.js +40 -0
- package/dist/calendar/rules/observedDate.d.ts +30 -0
- package/dist/calendar/rules/observedDate.js +50 -0
- package/dist/calendar/validate/index.d.ts +9 -4
- package/dist/calendar/validate/index.js +10 -4
- package/dist/calendar/validate/isValidBusinessCalendar.d.ts +3 -2
- package/dist/calendar/validate/isValidBusinessCalendar.js +38 -37
- package/dist/calendar/validate/isValidFiscalCalendar.d.ts +24 -0
- package/dist/calendar/validate/isValidFiscalCalendar.js +39 -0
- package/dist/calendar/validate/isValidFiscalExtraWeek.d.ts +20 -0
- package/dist/calendar/validate/isValidFiscalExtraWeek.js +24 -0
- package/dist/calendar/validate/isValidFiscalPattern.d.ts +10 -9
- package/dist/calendar/validate/isValidFiscalPattern.js +28 -27
- package/dist/calendar/validate/isValidFiscalYearLabel.d.ts +21 -0
- package/dist/calendar/validate/isValidFiscalYearLabel.js +25 -0
- package/dist/calendar/validate/isValidHolidayRule.d.ts +32 -0
- package/dist/calendar/validate/isValidHolidayRule.js +41 -0
- package/dist/calendar/validate/isValidRollConvention.d.ts +3 -2
- package/dist/calendar/validate/isValidRollConvention.js +32 -36
- package/dist/calendar/validate/isValidZoneBucketUnit.d.ts +4 -3
- package/dist/calendar/validate/isValidZoneBucketUnit.js +35 -36
- package/dist/duration/calculate/absDuration.d.ts +1 -1
- package/dist/duration/calculate/absDuration.js +30 -29
- package/dist/duration/calculate/addDuration.d.ts +1 -1
- package/dist/duration/calculate/addDuration.js +30 -29
- package/dist/duration/calculate/durationFromUnits.d.ts +3 -2
- package/dist/duration/calculate/durationFromUnits.js +63 -65
- package/dist/duration/calculate/getDurationSign.d.ts +1 -1
- package/dist/duration/calculate/getDurationSign.js +32 -31
- package/dist/duration/calculate/getDurationUnit.d.ts +4 -3
- package/dist/duration/calculate/getDurationUnit.js +45 -44
- package/dist/duration/calculate/index.d.ts +12 -9
- package/dist/duration/calculate/index.js +13 -9
- package/dist/duration/calculate/negateDuration.d.ts +1 -1
- package/dist/duration/calculate/negateDuration.js +30 -29
- package/dist/duration/calculate/subtractDuration.d.ts +1 -1
- package/dist/duration/calculate/subtractDuration.js +31 -30
- package/dist/duration/calculate/totalDuration.d.ts +21 -16
- package/dist/duration/calculate/totalDuration.js +80 -77
- package/dist/duration/calculate/totalUnits.d.ts +4 -2
- package/dist/duration/calculate/totalUnits.js +67 -68
- package/dist/duration/calculate/totalUnitsFromNow.d.ts +48 -0
- package/dist/duration/calculate/totalUnitsFromNow.js +60 -0
- package/dist/duration/calculate/ttlFromNow.d.ts +52 -0
- package/dist/duration/calculate/ttlFromNow.js +61 -0
- package/dist/duration/compare/compareDurations.d.ts +16 -15
- package/dist/duration/compare/compareDurations.js +67 -67
- package/dist/duration/compare/index.d.ts +2 -1
- package/dist/duration/compare/index.js +3 -1
- package/dist/duration/format/formatDuration.d.ts +25 -25
- package/dist/duration/format/formatDuration.js +94 -118
- package/dist/duration/format/formatHumanDuration.d.ts +32 -0
- package/dist/duration/format/formatHumanDuration.js +60 -0
- package/dist/duration/format/index.d.ts +3 -1
- package/dist/duration/format/index.js +4 -1
- package/dist/duration/index.d.ts +24 -7
- package/dist/duration/index.js +21 -8
- package/dist/duration/normalize/index.d.ts +2 -1
- package/dist/duration/normalize/index.js +3 -1
- package/dist/duration/normalize/normalizeDuration.d.ts +46 -45
- package/dist/duration/normalize/normalizeDuration.js +65 -65
- package/dist/duration/parse/index.d.ts +3 -1
- package/dist/duration/parse/index.js +4 -1
- package/dist/duration/parse/parseDuration.d.ts +25 -25
- package/dist/duration/parse/parseDuration.js +32 -34
- package/dist/duration/parse/parseHumanDuration.d.ts +71 -0
- package/dist/duration/parse/parseHumanDuration.js +86 -0
- package/dist/duration/validate/index.d.ts +2 -1
- package/dist/duration/validate/index.js +3 -1
- package/dist/duration/validate/isValidDuration.d.ts +6 -1
- package/dist/duration/validate/isValidDuration.js +7 -27
- package/dist/gnss/convert/gnssToUtc.d.ts +24 -0
- package/dist/gnss/convert/gnssToUtc.js +40 -0
- package/dist/gnss/convert/gnssWeekToUtc.d.ts +53 -0
- package/dist/gnss/convert/gnssWeekToUtc.js +77 -0
- package/dist/gnss/convert/index.d.ts +7 -0
- package/dist/gnss/convert/index.js +8 -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 +54 -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 +42 -0
- package/dist/gnss/index.d.ts +8 -0
- package/dist/gnss/index.js +9 -0
- package/dist/index.d.ts +821 -16
- package/dist/index.js +757 -16
- package/dist/instant/convert/classifyLocal.d.ts +5 -5
- package/dist/instant/convert/classifyLocal.js +57 -68
- package/dist/instant/convert/fromOffsetInstant.d.ts +6 -6
- package/dist/instant/convert/fromOffsetInstant.js +81 -95
- package/dist/instant/convert/index.d.ts +5 -4
- package/dist/instant/convert/index.js +6 -4
- package/dist/instant/convert/resolveLocal.d.ts +21 -20
- package/dist/instant/convert/resolveLocal.js +64 -74
- package/dist/instant/convert/toOffsetInstant.d.ts +29 -29
- package/dist/instant/convert/toOffsetInstant.js +125 -170
- package/dist/instant/index.d.ts +10 -3
- package/dist/instant/index.js +10 -4
- package/dist/instant/parse/index.d.ts +2 -0
- package/dist/instant/parse/index.js +3 -0
- package/dist/instant/parse/parseSqlOffsetDateTime.d.ts +47 -0
- package/dist/instant/parse/parseSqlOffsetDateTime.js +58 -0
- package/dist/instant/validate/index.d.ts +3 -1
- package/dist/instant/validate/index.js +4 -1
- package/dist/instant/validate/isValidSqlOffsetDateTime.d.ts +37 -0
- package/dist/instant/validate/isValidSqlOffsetDateTime.js +8 -0
- package/dist/instant/validate/isValidUtcOffset.d.ts +7 -2
- package/dist/instant/validate/isValidUtcOffset.js +7 -34
- package/dist/intermodal/calculate/billingTimeline.d.ts +48 -48
- package/dist/intermodal/calculate/billingTimeline.js +112 -135
- package/dist/intermodal/calculate/chargeableDays.d.ts +47 -46
- package/dist/intermodal/calculate/chargeableDays.js +93 -101
- package/dist/intermodal/calculate/demurrageClock.d.ts +25 -24
- package/dist/intermodal/calculate/demurrageClock.js +105 -127
- package/dist/intermodal/calculate/freeTimeExpiry.d.ts +19 -18
- package/dist/intermodal/calculate/freeTimeExpiry.js +88 -90
- package/dist/intermodal/calculate/index.d.ts +6 -5
- package/dist/intermodal/calculate/index.js +7 -5
- package/dist/intermodal/calculate/multimodalETA.d.ts +18 -18
- package/dist/intermodal/calculate/multimodalETA.js +115 -139
- package/dist/intermodal/format/bolTimestamp.d.ts +15 -15
- package/dist/intermodal/format/bolTimestamp.js +70 -73
- package/dist/intermodal/format/formatEdifactDate.d.ts +2 -2
- package/dist/intermodal/format/formatEdifactDate.js +41 -39
- package/dist/intermodal/format/formatEdifactDatePeriod.d.ts +2 -2
- package/dist/intermodal/format/formatEdifactDatePeriod.js +42 -40
- package/dist/intermodal/format/formatEdifactDateTime.d.ts +2 -2
- package/dist/intermodal/format/formatEdifactDateTime.js +44 -42
- package/dist/intermodal/format/formatEdifactDateTimePeriod.d.ts +2 -2
- package/dist/intermodal/format/formatEdifactDateTimePeriod.js +47 -45
- package/dist/intermodal/format/formatEdifactOffsetDateTime.d.ts +2 -2
- package/dist/intermodal/format/formatEdifactOffsetDateTime.js +69 -67
- package/dist/intermodal/format/formatEdifactTime.d.ts +2 -2
- package/dist/intermodal/format/formatEdifactTime.js +42 -40
- package/dist/intermodal/format/formatEpcisEvent.d.ts +5 -4
- package/dist/intermodal/format/formatEpcisEvent.js +69 -77
- package/dist/intermodal/format/formatX12Date.d.ts +2 -2
- package/dist/intermodal/format/formatX12Date.js +42 -40
- package/dist/intermodal/format/formatX12DateRange.d.ts +2 -2
- package/dist/intermodal/format/formatX12DateRange.js +44 -42
- package/dist/intermodal/format/formatX12DateTime.d.ts +2 -2
- package/dist/intermodal/format/formatX12DateTime.js +46 -44
- package/dist/intermodal/format/formatX12DateTimeRange.d.ts +2 -2
- package/dist/intermodal/format/formatX12DateTimeRange.js +47 -45
- package/dist/intermodal/format/formatX12Time.d.ts +2 -2
- package/dist/intermodal/format/formatX12Time.js +49 -47
- package/dist/intermodal/format/formatX12TimeElement.d.ts +2 -2
- package/dist/intermodal/format/formatX12TimeElement.js +53 -51
- package/dist/intermodal/format/index.d.ts +15 -14
- package/dist/intermodal/format/index.js +16 -14
- package/dist/intermodal/index.d.ts +60 -5
- package/dist/intermodal/index.js +58 -6
- package/dist/intermodal/parse/classifyEdifactDtmFormat.d.ts +2 -2
- package/dist/intermodal/parse/classifyEdifactDtmFormat.js +55 -52
- package/dist/intermodal/parse/classifyX12DateTimePeriodFormat.d.ts +2 -2
- package/dist/intermodal/parse/classifyX12DateTimePeriodFormat.js +57 -54
- package/dist/intermodal/parse/classifyX12TimeCode.d.ts +2 -2
- package/dist/intermodal/parse/classifyX12TimeCode.js +57 -53
- package/dist/intermodal/parse/index.d.ts +19 -18
- package/dist/intermodal/parse/index.js +20 -18
- package/dist/intermodal/parse/parseEdifactDate.d.ts +2 -2
- package/dist/intermodal/parse/parseEdifactDate.js +44 -42
- package/dist/intermodal/parse/parseEdifactDatePeriod.d.ts +2 -2
- package/dist/intermodal/parse/parseEdifactDatePeriod.js +50 -48
- package/dist/intermodal/parse/parseEdifactDateTime.d.ts +2 -2
- package/dist/intermodal/parse/parseEdifactDateTime.js +50 -48
- package/dist/intermodal/parse/parseEdifactDateTimePeriod.d.ts +2 -2
- package/dist/intermodal/parse/parseEdifactDateTimePeriod.js +52 -50
- package/dist/intermodal/parse/parseEdifactOffsetDateTime.d.ts +2 -2
- package/dist/intermodal/parse/parseEdifactOffsetDateTime.js +67 -65
- package/dist/intermodal/parse/parseEdifactTime.d.ts +2 -2
- package/dist/intermodal/parse/parseEdifactTime.js +44 -42
- package/dist/intermodal/parse/parseEpcisEvent.d.ts +24 -23
- package/dist/intermodal/parse/parseEpcisEvent.js +88 -100
- package/dist/intermodal/parse/parseX12Date.d.ts +2 -2
- package/dist/intermodal/parse/parseX12Date.js +46 -44
- package/dist/intermodal/parse/parseX12DateAndTime.d.ts +1 -1
- package/dist/intermodal/parse/parseX12DateAndTime.js +60 -58
- package/dist/intermodal/parse/parseX12DateRange.d.ts +2 -2
- package/dist/intermodal/parse/parseX12DateRange.js +51 -49
- package/dist/intermodal/parse/parseX12DateTime.d.ts +2 -2
- package/dist/intermodal/parse/parseX12DateTime.js +52 -50
- package/dist/intermodal/parse/parseX12DateTimeRange.d.ts +2 -2
- package/dist/intermodal/parse/parseX12DateTimeRange.js +53 -51
- package/dist/intermodal/parse/parseX12Time.d.ts +2 -2
- package/dist/intermodal/parse/parseX12Time.js +72 -74
- package/dist/intermodal/parse/x12TimeCodeOffset.d.ts +2 -2
- package/dist/intermodal/parse/x12TimeCodeOffset.js +98 -105
- package/dist/intermodal/parse/x12TimeCodeZone.d.ts +6 -4
- package/dist/intermodal/parse/x12TimeCodeZone.js +115 -101
- package/dist/intermodal/validate/index.d.ts +19 -18
- package/dist/intermodal/validate/index.js +20 -18
- package/dist/intermodal/validate/isValidEdifactDate.d.ts +2 -2
- package/dist/intermodal/validate/isValidEdifactDate.js +29 -25
- package/dist/intermodal/validate/isValidEdifactDatePeriod.d.ts +2 -2
- package/dist/intermodal/validate/isValidEdifactDatePeriod.js +31 -27
- package/dist/intermodal/validate/isValidEdifactDateTime.d.ts +2 -2
- package/dist/intermodal/validate/isValidEdifactDateTime.js +33 -29
- package/dist/intermodal/validate/isValidEdifactDateTimePeriod.d.ts +2 -2
- package/dist/intermodal/validate/isValidEdifactDateTimePeriod.js +31 -27
- package/dist/intermodal/validate/isValidEdifactDtmFormat.d.ts +2 -2
- package/dist/intermodal/validate/isValidEdifactDtmFormat.js +43 -40
- package/dist/intermodal/validate/isValidEdifactOffsetDateTime.d.ts +2 -2
- package/dist/intermodal/validate/isValidEdifactOffsetDateTime.js +39 -35
- package/dist/intermodal/validate/isValidEdifactTime.d.ts +2 -2
- package/dist/intermodal/validate/isValidEdifactTime.js +31 -27
- package/dist/intermodal/validate/isValidEpcisEvent.d.ts +1 -1
- package/dist/intermodal/validate/isValidEpcisEvent.js +52 -54
- package/dist/intermodal/validate/isValidEpcisEventTime.d.ts +6 -2
- package/dist/intermodal/validate/isValidEpcisEventTime.js +14 -47
- package/dist/intermodal/validate/isValidEpcisTimeZoneOffset.d.ts +6 -1
- package/dist/intermodal/validate/isValidEpcisTimeZoneOffset.js +8 -37
- package/dist/intermodal/validate/isValidX12Date.d.ts +2 -2
- package/dist/intermodal/validate/isValidX12Date.js +31 -27
- package/dist/intermodal/validate/isValidX12DateAndTime.d.ts +1 -1
- package/dist/intermodal/validate/isValidX12DateAndTime.js +36 -32
- package/dist/intermodal/validate/isValidX12DateRange.d.ts +2 -2
- package/dist/intermodal/validate/isValidX12DateRange.js +32 -28
- package/dist/intermodal/validate/isValidX12DateTime.d.ts +2 -2
- package/dist/intermodal/validate/isValidX12DateTime.js +33 -29
- package/dist/intermodal/validate/isValidX12DateTimePeriodFormat.d.ts +2 -2
- package/dist/intermodal/validate/isValidX12DateTimePeriodFormat.js +47 -44
- package/dist/intermodal/validate/isValidX12DateTimeRange.d.ts +2 -2
- package/dist/intermodal/validate/isValidX12DateTimeRange.js +34 -30
- package/dist/intermodal/validate/isValidX12Time.d.ts +2 -2
- package/dist/intermodal/validate/isValidX12Time.js +41 -37
- package/dist/intermodal/validate/isValidX12TimeCode.d.ts +2 -2
- package/dist/intermodal/validate/isValidX12TimeCode.js +42 -39
- package/dist/internal/adjustZonedBusinessDays.d.ts +1 -1
- package/dist/internal/adjustZonedBusinessDays.js +16 -16
- package/dist/internal/advanceToWeekday.d.ts +2 -2
- package/dist/internal/advanceToWeekday.js +20 -22
- package/dist/internal/arrowTimestamp.d.ts +26 -0
- package/dist/internal/arrowTimestamp.js +67 -0
- package/dist/internal/businessCalendar.d.ts +46 -15
- package/dist/internal/businessCalendar.js +171 -201
- package/dist/internal/businessDayValues.d.ts +3 -2
- package/dist/internal/businessDayValues.js +42 -49
- package/dist/internal/calendarDatePairPolicy.d.ts +7 -6
- package/dist/internal/calendarDatePairPolicy.js +29 -23
- package/dist/internal/calendarDateString.d.ts +2 -2
- package/dist/internal/calendarDateString.js +51 -56
- package/dist/internal/calendarSystemIds.d.ts +3 -2
- package/dist/internal/calendarSystemIds.js +51 -52
- package/dist/internal/calendarValueOfDate.d.ts +3 -2
- package/dist/internal/calendarValueOfDate.js +32 -37
- package/dist/internal/calendarValueOfZoned.d.ts +3 -2
- package/dist/internal/calendarValueOfZoned.js +46 -51
- package/dist/internal/calendarZonedPairPolicy.d.ts +7 -6
- package/dist/internal/calendarZonedPairPolicy.js +30 -24
- package/dist/internal/calendarZonedString.d.ts +10 -7
- package/dist/internal/calendarZonedString.js +61 -65
- package/dist/internal/compareUnixEpochs.d.ts +2 -2
- package/dist/internal/compareUnixEpochs.js +22 -22
- package/dist/internal/cronMatch.d.ts +56 -0
- package/dist/internal/cronMatch.js +91 -0
- package/dist/internal/cronText.d.ts +13 -0
- package/dist/internal/cronText.js +279 -0
- package/dist/internal/cutoffAtResolved.d.ts +63 -0
- package/dist/internal/cutoffAtResolved.js +135 -0
- package/dist/internal/cycleFieldValue.d.ts +3 -5
- package/dist/internal/cycleFieldValue.js +42 -48
- package/dist/internal/dateCycleFieldBounds.d.ts +7 -6
- package/dist/internal/dateCycleFieldBounds.js +31 -25
- package/dist/internal/dateTimeUnitHelpers.d.ts +2 -2
- package/dist/internal/dateTimeUnitHelpers.js +68 -71
- package/dist/internal/dateUnitHelpers.d.ts +2 -2
- package/dist/internal/dateUnitHelpers.js +96 -97
- package/dist/internal/daylightTime.d.ts +2 -2
- package/dist/internal/daylightTime.js +113 -142
- package/dist/internal/defaultFractionalDigits.d.ts +3 -2
- package/dist/internal/defaultFractionalDigits.js +19 -18
- package/dist/internal/differenceRecord.d.ts +4 -4
- package/dist/internal/differenceRecord.js +67 -68
- package/dist/internal/divisionBoundary.d.ts +1 -1
- package/dist/internal/divisionBoundary.js +23 -21
- package/dist/internal/durationUntilString.d.ts +5 -3
- package/dist/internal/durationUntilString.js +21 -20
- package/dist/internal/dutyEngine.d.ts +41 -40
- package/dist/internal/dutyEngine.js +1287 -1622
- package/dist/internal/dutyLog.d.ts +6 -6
- package/dist/internal/dutyLog.js +39 -44
- package/dist/internal/dutyPeriods.d.ts +24 -24
- package/dist/internal/dutyPeriods.js +291 -332
- package/dist/internal/dutyRules.d.ts +129 -127
- package/dist/internal/dutyRules.js +386 -428
- package/dist/internal/dutyRunIndex.d.ts +150 -0
- package/dist/internal/dutyRunIndex.js +392 -0
- package/dist/internal/earlierOccurrence.d.ts +41 -0
- package/dist/internal/earlierOccurrence.js +59 -0
- package/dist/internal/easter.d.ts +9 -0
- package/dist/internal/easter.js +52 -0
- package/dist/internal/ediDateTimeFields.d.ts +4 -4
- package/dist/internal/ediDateTimeFields.js +222 -252
- package/dist/internal/ediDateTimeWriter.d.ts +2 -2
- package/dist/internal/ediDateTimeWriter.js +205 -248
- package/dist/internal/ediGrammar.d.ts +16 -18
- package/dist/internal/ediGrammar.js +508 -341
- package/dist/internal/englishCalendarNames.d.ts +12 -1
- package/dist/internal/englishCalendarNames.js +50 -47
- package/dist/internal/epochDay.d.ts +41 -0
- package/dist/internal/epochDay.js +106 -0
- package/dist/internal/epochNanoseconds.d.ts +1 -1
- package/dist/internal/epochNanoseconds.js +28 -27
- package/dist/internal/exactDuration.d.ts +1 -1
- package/dist/internal/exactDuration.js +51 -58
- package/dist/internal/exactMoment.d.ts +12 -12
- package/dist/internal/exactMoment.js +101 -104
- package/dist/internal/exactSeconds.d.ts +10 -0
- package/dist/internal/exactSeconds.js +19 -0
- package/dist/internal/fiscalCalendar.d.ts +44 -9
- package/dist/internal/fiscalCalendar.js +155 -69
- package/dist/internal/floorDivide.d.ts +1 -1
- package/dist/internal/floorDivide.js +18 -16
- package/dist/internal/foreignEpochs.d.ts +29 -0
- package/dist/internal/foreignEpochs.js +149 -122
- package/dist/internal/formatCalendarDays.d.ts +5 -5
- package/dist/internal/formatCalendarDays.js +41 -42
- package/dist/internal/formatDateInCalendar.d.ts +4 -3
- package/dist/internal/formatDateInCalendar.js +24 -21
- package/dist/internal/formatRelativeDuration.d.ts +16 -13
- package/dist/internal/formatRelativeDuration.js +91 -74
- package/dist/internal/formatterCache.d.ts +40 -0
- package/dist/internal/formatterCache.js +156 -0
- package/dist/internal/freeTimeLedger.d.ts +47 -59
- package/dist/internal/freeTimeLedger.js +411 -246
- package/dist/internal/getLocaleFirstDayOfWeek.d.ts +2 -2
- package/dist/internal/getLocaleFirstDayOfWeek.js +23 -22
- package/dist/internal/getLocaleWeekYearBounds.d.ts +7 -7
- package/dist/internal/getLocaleWeekYearBounds.js +47 -53
- package/dist/internal/getLocaleWeekendDays.d.ts +2 -2
- package/dist/internal/getLocaleWeekendDays.js +22 -21
- package/dist/internal/gnssTimeScales.d.ts +53 -0
- package/dist/internal/gnssTimeScales.js +100 -0
- package/dist/internal/gnssWeek.d.ts +92 -0
- package/dist/internal/gnssWeek.js +204 -0
- package/dist/internal/halfOpenIntervals.d.ts +4 -4
- package/dist/internal/halfOpenIntervals.js +136 -162
- package/dist/internal/hasCalendarAnnotation.d.ts +4 -4
- package/dist/internal/hasCalendarAnnotation.js +30 -27
- package/dist/internal/holidayRules.d.ts +81 -0
- package/dist/internal/holidayRules.js +336 -0
- package/dist/internal/hourDurationString.d.ts +1 -1
- package/dist/internal/hourDurationString.js +44 -43
- package/dist/internal/httpDateFields.d.ts +10 -10
- package/dist/internal/httpDateFields.js +66 -76
- package/dist/internal/humanDuration.d.ts +36 -0
- package/dist/internal/humanDuration.js +190 -0
- package/dist/internal/identifierText.d.ts +42 -0
- package/dist/internal/identifierText.js +51 -0
- package/dist/internal/index.d.ts +78 -63
- package/dist/internal/index.js +79 -67
- package/dist/internal/inputChecks.d.ts +99 -0
- package/dist/internal/inputChecks.js +190 -0
- package/dist/internal/instantFormatOptions.d.ts +2 -2
- package/dist/internal/instantFormatOptions.js +77 -91
- package/dist/internal/instantIntervalText.d.ts +5 -5
- package/dist/internal/instantIntervalText.js +26 -23
- package/dist/internal/instantNanoseconds.d.ts +3 -3
- package/dist/internal/instantNanoseconds.js +169 -200
- package/dist/internal/instantStringFromEpochNanoseconds.d.ts +8 -0
- package/dist/internal/instantStringFromEpochNanoseconds.js +20 -0
- package/dist/internal/intervalCountHelpers.d.ts +14 -13
- package/dist/internal/intervalCountHelpers.js +31 -28
- package/dist/internal/intervalNanoseconds.d.ts +5 -5
- package/dist/internal/intervalNanoseconds.js +73 -80
- package/dist/internal/isObject.d.ts +1 -1
- package/dist/internal/isObject.js +36 -33
- package/dist/internal/isValidAmount.d.ts +1 -1
- package/dist/internal/isValidAmount.js +12 -9
- package/dist/internal/isValidDayOfWeek.d.ts +1 -1
- package/dist/internal/isValidDayOfWeek.js +14 -11
- package/dist/internal/isYearMonthDurationUnit.d.ts +11 -0
- package/dist/internal/isYearMonthDurationUnit.js +16 -0
- package/dist/internal/isoStringBody.d.ts +3 -3
- package/dist/internal/isoStringBody.js +92 -90
- package/dist/internal/isoYearString.d.ts +1 -1
- package/dist/internal/isoYearString.js +24 -23
- package/dist/internal/joinDateTimeConnector.d.ts +1 -1
- package/dist/internal/joinDateTimeConnector.js +73 -82
- package/dist/internal/leapSeconds.d.ts +63 -0
- package/dist/internal/leapSeconds.js +140 -0
- package/dist/internal/lengthFromNow.d.ts +92 -0
- package/dist/internal/lengthFromNow.js +117 -0
- package/dist/internal/localResolution.d.ts +67 -0
- package/dist/internal/localResolution.js +228 -0
- package/dist/internal/localeMonthNames.d.ts +35 -0
- package/dist/internal/localeMonthNames.js +61 -0
- package/dist/internal/localeWeekInfo.d.ts +13 -13
- package/dist/internal/localeWeekInfo.js +25 -24
- package/dist/internal/maxPieces.d.ts +2 -2
- package/dist/internal/maxPieces.js +45 -47
- package/dist/internal/measureNearRangeEnd.d.ts +8 -8
- package/dist/internal/measureNearRangeEnd.js +40 -40
- package/dist/internal/monthDay.d.ts +19 -0
- package/dist/internal/monthDay.js +23 -0
- package/dist/internal/monthGridWeekRow.d.ts +2 -2
- package/dist/internal/monthGridWeekRow.js +19 -16
- package/dist/internal/normalizeDateTime.d.ts +5 -4
- package/dist/internal/normalizeDateTime.js +24 -32
- package/dist/internal/normalizeTimeZone.d.ts +2 -2
- package/dist/internal/normalizeTimeZone.js +31 -32
- package/dist/internal/nthWeekday.d.ts +27 -0
- package/dist/internal/nthWeekday.js +56 -0
- package/dist/internal/observance.d.ts +18 -0
- package/dist/internal/observance.js +56 -0
- package/dist/internal/offsetTimeline.d.ts +57 -0
- package/dist/internal/offsetTimeline.js +132 -0
- package/dist/internal/operatingSchedule.d.ts +44 -47
- package/dist/internal/operatingSchedule.js +878 -705
- package/dist/internal/optionOrDefault.d.ts +1 -1
- package/dist/internal/optionOrDefault.js +21 -18
- package/dist/internal/patternToken.d.ts +24 -9
- package/dist/internal/patternToken.js +439 -395
- package/dist/internal/plainDateAdd.d.ts +2 -2
- package/dist/internal/plainDateAdd.js +33 -36
- package/dist/internal/plainDateUntil.d.ts +4 -3
- package/dist/internal/plainDateUntil.js +39 -47
- package/dist/internal/plainFormatOptions.d.ts +56 -1
- package/dist/internal/plainFormatOptions.js +334 -149
- package/dist/internal/position.d.ts +66 -0
- package/dist/internal/position.js +54 -0
- package/dist/internal/prefixMilliseconds.d.ts +9 -0
- package/dist/internal/prefixMilliseconds.js +21 -0
- package/dist/internal/protoRecord.d.ts +22 -0
- package/dist/internal/protoRecord.js +36 -0
- package/dist/internal/punctuality.d.ts +5 -4
- package/dist/internal/punctuality.js +51 -54
- package/dist/internal/readDateTimeFormatOptions.d.ts +1 -1
- package/dist/internal/readDateTimeFormatOptions.js +78 -85
- package/dist/internal/readDurationUnits.d.ts +3 -2
- package/dist/internal/readDurationUnits.js +64 -71
- package/dist/internal/readSetFields.d.ts +2 -4
- package/dist/internal/readSetFields.js +138 -152
- package/dist/internal/recurrenceExpansion.d.ts +103 -0
- package/dist/internal/recurrenceExpansion.js +833 -0
- package/dist/internal/recurrenceRuleText.d.ts +14 -0
- package/dist/internal/recurrenceRuleText.js +342 -0
- package/dist/internal/repairRangeParts.d.ts +30 -0
- package/dist/internal/repairRangeParts.js +41 -0
- package/dist/internal/resolveDateTimeUnit.d.ts +1 -1
- package/dist/internal/resolveDateTimeUnit.js +11 -11
- package/dist/internal/resolveDurationRelativeTo.d.ts +4 -3
- package/dist/internal/resolveDurationRelativeTo.js +64 -77
- package/dist/internal/resolveDurationUnit.d.ts +1 -1
- package/dist/internal/resolveDurationUnit.js +10 -12
- package/dist/internal/resolveLocale.d.ts +3 -3
- package/dist/internal/resolveLocale.js +46 -55
- package/dist/internal/resolveManualRoundingOptions.d.ts +4 -4
- package/dist/internal/resolveManualRoundingOptions.js +37 -34
- package/dist/internal/resolveMinimalDaysInFirstWeek.d.ts +2 -2
- package/dist/internal/resolveMinimalDaysInFirstWeek.js +24 -24
- package/dist/internal/resolveOverflow.d.ts +3 -2
- package/dist/internal/resolveOverflow.js +18 -15
- package/dist/internal/resolveRelativeRounding.d.ts +3 -2
- package/dist/internal/resolveRelativeRounding.js +37 -38
- package/dist/internal/resolveRelativeUnit.d.ts +3 -2
- package/dist/internal/resolveRelativeUnit.js +35 -38
- package/dist/internal/resolveUnixIntervalPair.d.ts +12 -12
- package/dist/internal/resolveUnixIntervalPair.js +48 -54
- package/dist/internal/resolveWeekStartsOn.d.ts +1 -1
- package/dist/internal/resolveWeekStartsOn.js +16 -16
- package/dist/internal/rfc5322DateTime.d.ts +11 -11
- package/dist/internal/rfc5322DateTime.js +99 -157
- package/dist/internal/rinexWeek.d.ts +22 -0
- package/dist/internal/rinexWeek.js +40 -0
- package/dist/internal/rollBusinessDate.d.ts +16 -0
- package/dist/internal/rollBusinessDate.js +37 -0
- package/dist/internal/splitStep.d.ts +3 -3
- package/dist/internal/splitStep.js +173 -191
- package/dist/internal/sqlDateTime.d.ts +12 -0
- package/dist/internal/sqlDateTime.js +26 -0
- package/dist/internal/sqlOffsetDateTime.d.ts +22 -0
- package/dist/internal/sqlOffsetDateTime.js +41 -0
- package/dist/internal/startOrEndOfUnix.d.ts +5 -5
- package/dist/internal/startOrEndOfUnix.js +41 -46
- package/dist/internal/startOrEndOfUtc.d.ts +6 -5
- package/dist/internal/startOrEndOfUtc.js +144 -158
- package/dist/internal/startOrEndOfZoned.d.ts +7 -5
- package/dist/internal/startOrEndOfZoned.js +36 -42
- package/dist/internal/temporal.d.ts +2 -0
- package/dist/internal/temporal.js +3 -0
- package/dist/internal/temporalCompat/calendarDateArithmetic.d.ts +9 -3
- package/dist/internal/temporalCompat/calendarDateArithmetic.js +132 -168
- package/dist/internal/temporalCompat/calendarDateFromFields.d.ts +10 -7
- package/dist/internal/temporalCompat/calendarDateFromFields.js +88 -98
- package/dist/internal/temporalCompat/calendarDateFromMonthCode.d.ts +22 -0
- package/dist/internal/temporalCompat/calendarDateFromMonthCode.js +77 -0
- package/dist/internal/temporalCompat/calendarFields.d.ts +22 -9
- package/dist/internal/temporalCompat/calendarFields.js +139 -102
- package/dist/internal/temporalCompat/capabilities.d.ts +83 -6
- package/dist/internal/temporalCompat/capabilities.js +175 -87
- package/dist/internal/temporalCompat/clock.d.ts +41 -0
- package/dist/internal/temporalCompat/clock.js +72 -0
- package/dist/internal/temporalCompat/fieldSearch.d.ts +5 -5
- package/dist/internal/temporalCompat/fieldSearch.js +39 -58
- package/dist/internal/temporalCompat/fixedDay.d.ts +2 -2
- package/dist/internal/temporalCompat/fixedDay.js +32 -36
- package/dist/internal/temporalCompat/fixedMonthArithmetic.d.ts +5 -0
- package/dist/internal/temporalCompat/fixedMonthArithmetic.js +16 -0
- package/dist/internal/temporalCompat/hebrewArithmetic.d.ts +7 -7
- package/dist/internal/temporalCompat/hebrewArithmetic.js +91 -122
- package/dist/internal/temporalCompat/index.d.ts +9 -4
- package/dist/internal/temporalCompat/index.js +10 -5
- package/dist/internal/temporalCompat/indianArithmetic.d.ts +6 -6
- package/dist/internal/temporalCompat/indianArithmetic.js +53 -74
- package/dist/internal/temporalCompat/islamicEra.d.ts +6 -0
- package/dist/internal/temporalCompat/islamicEra.js +50 -0
- package/dist/internal/temporalCompat/isoCalendarFrom.d.ts +38 -0
- package/dist/internal/temporalCompat/isoCalendarFrom.js +59 -0
- package/dist/internal/temporalCompat/largeMonthSpan.d.ts +7 -2
- package/dist/internal/temporalCompat/largeMonthSpan.js +125 -160
- package/dist/internal/temporalCompat/nonIsoArithmetic.d.ts +24 -24
- package/dist/internal/temporalCompat/nonIsoArithmetic.js +135 -177
- package/dist/internal/temporalCompat/probeRepros.d.ts +50 -0
- package/dist/internal/temporalCompat/probeRepros.js +887 -0
- package/dist/internal/temporalCompat/readArithmeticModel.d.ts +2 -2
- package/dist/internal/temporalCompat/readArithmeticModel.js +208 -230
- package/dist/internal/temporalCompat/repros.d.ts +10 -16
- package/dist/internal/temporalCompat/repros.js +181 -677
- package/dist/internal/temporalCompat/timeZoneEquals.d.ts +38 -0
- package/dist/internal/temporalCompat/timeZoneEquals.js +68 -0
- package/dist/internal/timeCycleFieldBounds.d.ts +5 -4
- package/dist/internal/timeCycleFieldBounds.js +31 -22
- package/dist/internal/timeScaleString.d.ts +47 -0
- package/dist/internal/timeScaleString.js +74 -0
- package/dist/internal/timestampEvents.d.ts +8 -7
- package/dist/internal/timestampEvents.js +56 -69
- package/dist/internal/toInstantFromUtc.d.ts +2 -2
- package/dist/internal/toInstantFromUtc.js +27 -27
- package/dist/internal/twoDigitYear.d.ts +1 -1
- package/dist/internal/twoDigitYear.js +23 -20
- package/dist/internal/unixEpochValue.d.ts +11 -11
- package/dist/internal/unixEpochValue.js +193 -222
- package/dist/internal/unixFormatReference.d.ts +3 -3
- package/dist/internal/unixFormatReference.js +36 -41
- package/dist/internal/unixWallClock.d.ts +4 -4
- package/dist/internal/unixWallClock.js +33 -32
- package/dist/internal/utcOffsetString.d.ts +16 -0
- package/dist/internal/utcOffsetString.js +77 -64
- package/dist/internal/utcReading.d.ts +59 -0
- package/dist/internal/utcReading.js +100 -0
- package/dist/internal/utcWallClock.d.ts +3 -3
- package/dist/internal/utcWallClock.js +30 -29
- package/dist/internal/validatedZones.d.ts +20 -0
- package/dist/internal/validatedZones.js +34 -0
- package/dist/internal/wallClockAtOffset.d.ts +2 -2
- package/dist/internal/wallClockAtOffset.js +24 -24
- package/dist/internal/yearMonth.d.ts +11 -0
- package/dist/internal/yearMonth.js +15 -0
- package/dist/internal/yearMonthArithmetic.d.ts +18 -0
- package/dist/internal/yearMonthArithmetic.js +42 -0
- package/dist/internal/yearWindowStart.d.ts +2 -2
- package/dist/internal/yearWindowStart.js +37 -43
- package/dist/internal/zoneBucketCap.d.ts +4 -3
- package/dist/internal/zoneBucketCap.js +49 -55
- package/dist/internal/zoneFrame.d.ts +15 -15
- package/dist/internal/zoneFrame.js +183 -196
- package/dist/internal/zonedBucket.d.ts +5 -4
- package/dist/internal/zonedBucket.js +384 -368
- package/dist/internal/zonedDifference/calendarArithmetic.d.ts +21 -0
- package/dist/internal/zonedDifference/calendarArithmetic.js +76 -0
- package/dist/internal/zonedDifference/nudgeOrigin.d.ts +30 -0
- package/dist/internal/zonedDifference/nudgeOrigin.js +53 -0
- package/dist/internal/zonedDifference/nudgeWindow.d.ts +40 -0
- package/dist/internal/zonedDifference/nudgeWindow.js +89 -0
- package/dist/internal/zonedDifference/operations.d.ts +99 -0
- package/dist/internal/zonedDifference/operations.js +613 -0
- package/dist/internal/zonedDifference/rangeLimit.d.ts +16 -0
- package/dist/internal/zonedDifference/rangeLimit.js +51 -0
- package/dist/internal/zonedDifference/utcValidity.d.ts +2 -0
- package/dist/internal/zonedDifference/utcValidity.js +9 -0
- package/dist/internal/zonedFormatReference.d.ts +2 -2
- package/dist/internal/zonedFormatReference.js +22 -21
- package/dist/internal/zonedLocalDates.d.ts +2 -2
- package/dist/internal/zonedLocalDates.js +50 -51
- package/dist/internal/zonedNowUnitValue.d.ts +2 -2
- package/dist/internal/zonedNowUnitValue.js +48 -57
- package/dist/internal/zonedTransitionSearch.d.ts +3 -1
- package/dist/internal/zonedTransitionSearch.js +241 -188
- package/dist/internal/zonedWallClock.d.ts +31 -10
- package/dist/internal/zonedWallClock.js +307 -404
- package/dist/internal/zonedWallClockDifference.d.ts +13 -46
- package/dist/internal/zonedWallClockDifference.js +140 -1167
- package/dist/internal/zonedWallClockOperations.d.ts +18 -15
- package/dist/internal/zonedWallClockOperations.js +388 -513
- package/dist/internal/zonelessCalendarDate.d.ts +2 -2
- package/dist/internal/zonelessCalendarDate.js +21 -19
- package/dist/interval/calculate/clampInterval.d.ts +3 -2
- package/dist/interval/calculate/clampInterval.js +29 -28
- package/dist/interval/calculate/index.d.ts +7 -6
- package/dist/interval/calculate/index.js +8 -6
- package/dist/interval/calculate/intersectIntervals.d.ts +3 -2
- package/dist/interval/calculate/intersectIntervals.js +38 -41
- package/dist/interval/calculate/mergeIntervals.d.ts +3 -2
- package/dist/interval/calculate/mergeIntervals.js +41 -42
- package/dist/interval/calculate/splitIntervalAt.d.ts +3 -2
- package/dist/interval/calculate/splitIntervalAt.js +56 -61
- package/dist/interval/calculate/subtractIntervals.d.ts +3 -2
- package/dist/interval/calculate/subtractIntervals.js +59 -62
- package/dist/interval/calculate/sumIntervals.d.ts +3 -2
- package/dist/interval/calculate/sumIntervals.js +38 -38
- package/dist/interval/compare/index.d.ts +3 -2
- package/dist/interval/compare/index.js +4 -2
- package/dist/interval/compare/intervalContains.d.ts +3 -2
- package/dist/interval/compare/intervalContains.js +37 -37
- package/dist/interval/compare/intervalsOverlap.d.ts +3 -2
- package/dist/interval/compare/intervalsOverlap.js +39 -40
- package/dist/interval/index.d.ts +14 -4
- package/dist/interval/index.js +12 -5
- package/dist/interval/validate/index.d.ts +2 -1
- package/dist/interval/validate/index.js +3 -1
- package/dist/interval/validate/isValidInterval.d.ts +3 -2
- package/dist/interval/validate/isValidInterval.js +40 -39
- package/dist/plain/calculate/addBusinessDays.d.ts +5 -4
- package/dist/plain/calculate/addBusinessDays.js +41 -40
- package/dist/plain/calculate/addDate.d.ts +11 -9
- package/dist/plain/calculate/addDate.js +58 -59
- package/dist/plain/calculate/addDateTime.d.ts +11 -9
- package/dist/plain/calculate/addDateTime.js +37 -43
- package/dist/plain/calculate/addTime.d.ts +3 -2
- package/dist/plain/calculate/addTime.js +37 -40
- package/dist/plain/calculate/addYearMonth.d.ts +40 -0
- package/dist/plain/calculate/addYearMonth.js +34 -0
- package/dist/plain/calculate/clampDate.d.ts +1 -1
- package/dist/plain/calculate/clampDate.js +39 -44
- package/dist/plain/calculate/closestDateTo.d.ts +1 -1
- package/dist/plain/calculate/closestDateTo.js +45 -53
- package/dist/plain/calculate/cycleDate.d.ts +19 -17
- package/dist/plain/calculate/cycleDate.js +56 -56
- package/dist/plain/calculate/cycleDateTime.d.ts +19 -17
- package/dist/plain/calculate/cycleDateTime.js +53 -53
- package/dist/plain/calculate/cycleTime.d.ts +11 -10
- package/dist/plain/calculate/cycleTime.js +51 -51
- package/dist/plain/calculate/diffDate.d.ts +5 -3
- package/dist/plain/calculate/diffDate.js +80 -95
- package/dist/plain/calculate/diffDateAsDuration.d.ts +6 -3
- package/dist/plain/calculate/diffDateAsDuration.js +58 -59
- package/dist/plain/calculate/diffDateTime.d.ts +5 -3
- package/dist/plain/calculate/diffDateTime.js +73 -92
- package/dist/plain/calculate/diffDateTimeAsDuration.d.ts +6 -3
- package/dist/plain/calculate/diffDateTimeAsDuration.js +51 -52
- package/dist/plain/calculate/diffTime.d.ts +5 -3
- package/dist/plain/calculate/diffTime.js +74 -93
- package/dist/plain/calculate/diffYearMonth.d.ts +25 -0
- package/dist/plain/calculate/diffYearMonth.js +44 -0
- package/dist/plain/calculate/endOfDate.d.ts +10 -10
- package/dist/plain/calculate/endOfDate.js +67 -70
- package/dist/plain/calculate/endOfDateTime.d.ts +20 -19
- package/dist/plain/calculate/endOfDateTime.js +141 -151
- package/dist/plain/calculate/endOfQuarterForDate.d.ts +1 -1
- package/dist/plain/calculate/endOfQuarterForDate.js +34 -32
- package/dist/plain/calculate/endOfQuarterForDateTime.d.ts +1 -1
- package/dist/plain/calculate/endOfQuarterForDateTime.js +42 -46
- package/dist/plain/calculate/endOfTime.d.ts +12 -11
- package/dist/plain/calculate/endOfTime.js +97 -103
- package/dist/plain/calculate/endOfYearMonth.d.ts +18 -0
- package/dist/plain/calculate/endOfYearMonth.js +31 -0
- package/dist/plain/calculate/getDayOfYear.d.ts +1 -1
- package/dist/plain/calculate/getDayOfYear.js +27 -26
- package/dist/plain/calculate/getDaysInMonth.d.ts +1 -1
- package/dist/plain/calculate/getDaysInMonth.js +27 -26
- package/dist/plain/calculate/getDaysInYear.d.ts +4 -1
- package/dist/plain/calculate/getDaysInYear.js +28 -24
- package/dist/plain/calculate/getDaysInYearMonth.d.ts +18 -0
- package/dist/plain/calculate/getDaysInYearMonth.js +31 -0
- package/dist/plain/calculate/getLargestDateDurationUnit.d.ts +4 -3
- package/dist/plain/calculate/getLargestDateDurationUnit.js +39 -36
- package/dist/plain/calculate/getLargestDateTimeDurationUnit.d.ts +4 -3
- package/dist/plain/calculate/getLargestDateTimeDurationUnit.js +43 -45
- package/dist/plain/calculate/getLargestTimeDurationUnit.d.ts +4 -3
- package/dist/plain/calculate/getLargestTimeDurationUnit.js +38 -40
- package/dist/plain/calculate/getLocaleDayOfWeek.d.ts +7 -7
- package/dist/plain/calculate/getLocaleDayOfWeek.js +38 -39
- package/dist/plain/calculate/getLocaleEndOfWeek.d.ts +5 -5
- package/dist/plain/calculate/getLocaleEndOfWeek.js +43 -43
- package/dist/plain/calculate/getLocaleStartOfWeek.d.ts +6 -6
- package/dist/plain/calculate/getLocaleStartOfWeek.js +43 -43
- package/dist/plain/calculate/getLocaleWeekYear.d.ts +19 -19
- package/dist/plain/calculate/getLocaleWeekYear.js +59 -62
- package/dist/plain/calculate/getQuarterForDate.d.ts +1 -1
- package/dist/plain/calculate/getQuarterForDate.js +29 -28
- package/dist/plain/calculate/getQuarterForDateTime.d.ts +1 -1
- package/dist/plain/calculate/getQuarterForDateTime.js +29 -28
- package/dist/plain/calculate/getWeekNumber.d.ts +1 -1
- package/dist/plain/calculate/getWeekNumber.js +52 -58
- package/dist/plain/calculate/getWeekOfMonth.d.ts +11 -15
- package/dist/plain/calculate/getWeekOfMonth.js +44 -49
- package/dist/plain/calculate/getWeekYear.d.ts +1 -1
- package/dist/plain/calculate/getWeekYear.js +32 -31
- package/dist/plain/calculate/getWeeksInLocaleWeekYear.d.ts +16 -16
- package/dist/plain/calculate/getWeeksInLocaleWeekYear.js +57 -60
- package/dist/plain/calculate/getWeeksInMonth.d.ts +9 -12
- package/dist/plain/calculate/getWeeksInMonth.js +42 -46
- package/dist/plain/calculate/getWeeksInYear.d.ts +1 -1
- package/dist/plain/calculate/getWeeksInYear.js +37 -36
- package/dist/plain/calculate/index.d.ts +72 -65
- package/dist/plain/calculate/index.js +73 -65
- package/dist/plain/calculate/maxDate.d.ts +1 -1
- package/dist/plain/calculate/maxDate.js +33 -38
- package/dist/plain/calculate/maxDateTime.d.ts +1 -1
- package/dist/plain/calculate/maxDateTime.js +33 -38
- package/dist/plain/calculate/maxTime.d.ts +1 -1
- package/dist/plain/calculate/maxTime.js +33 -38
- package/dist/plain/calculate/minDate.d.ts +1 -1
- package/dist/plain/calculate/minDate.js +33 -38
- package/dist/plain/calculate/minDateTime.d.ts +1 -1
- package/dist/plain/calculate/minDateTime.js +33 -38
- package/dist/plain/calculate/minTime.d.ts +1 -1
- package/dist/plain/calculate/minTime.js +33 -38
- package/dist/plain/calculate/nextWeekday.d.ts +22 -20
- package/dist/plain/calculate/nextWeekday.js +49 -47
- package/dist/plain/calculate/previousWeekday.d.ts +22 -20
- package/dist/plain/calculate/previousWeekday.js +49 -47
- package/dist/plain/calculate/roundDate.d.ts +26 -25
- package/dist/plain/calculate/roundDate.js +83 -103
- package/dist/plain/calculate/roundDateTime.d.ts +28 -27
- package/dist/plain/calculate/roundDateTime.js +99 -127
- package/dist/plain/calculate/roundTime.d.ts +24 -24
- package/dist/plain/calculate/roundTime.js +49 -51
- package/dist/plain/calculate/setDate.d.ts +11 -10
- package/dist/plain/calculate/setDate.js +59 -64
- package/dist/plain/calculate/setDateTime.d.ts +12 -11
- package/dist/plain/calculate/setDateTime.js +53 -58
- package/dist/plain/calculate/setTime.d.ts +11 -10
- package/dist/plain/calculate/setTime.js +55 -60
- package/dist/plain/calculate/sortDateTimes.d.ts +1 -1
- package/dist/plain/calculate/sortDateTimes.js +34 -38
- package/dist/plain/calculate/sortDates.d.ts +1 -1
- package/dist/plain/calculate/sortDates.js +34 -38
- package/dist/plain/calculate/sortTimes.d.ts +1 -1
- package/dist/plain/calculate/sortTimes.js +34 -38
- package/dist/plain/calculate/startOfDate.d.ts +10 -10
- package/dist/plain/calculate/startOfDate.js +65 -70
- package/dist/plain/calculate/startOfDateTime.d.ts +20 -19
- package/dist/plain/calculate/startOfDateTime.js +97 -99
- package/dist/plain/calculate/startOfQuarterForDate.d.ts +1 -1
- package/dist/plain/calculate/startOfQuarterForDate.js +34 -30
- package/dist/plain/calculate/startOfQuarterForDateTime.d.ts +1 -1
- package/dist/plain/calculate/startOfQuarterForDateTime.js +40 -41
- package/dist/plain/calculate/startOfTime.d.ts +12 -11
- package/dist/plain/calculate/startOfTime.js +54 -60
- package/dist/plain/calculate/startOfYearMonth.d.ts +17 -0
- package/dist/plain/calculate/startOfYearMonth.js +30 -0
- package/dist/plain/calculate/subtractBusinessDays.d.ts +5 -4
- package/dist/plain/calculate/subtractBusinessDays.js +40 -39
- package/dist/plain/calculate/subtractDate.d.ts +11 -9
- package/dist/plain/calculate/subtractDate.js +51 -52
- package/dist/plain/calculate/subtractDateTime.d.ts +11 -9
- package/dist/plain/calculate/subtractDateTime.js +37 -43
- package/dist/plain/calculate/subtractTime.d.ts +3 -2
- package/dist/plain/calculate/subtractTime.js +37 -40
- package/dist/plain/calculate/subtractYearMonth.d.ts +35 -0
- package/dist/plain/calculate/subtractYearMonth.js +29 -0
- package/dist/plain/calculate/weekOfYearForDate.d.ts +1 -1
- package/dist/plain/calculate/weekOfYearForDate.js +27 -26
- package/dist/plain/calculate/weekOfYearForDateTime.d.ts +1 -1
- package/dist/plain/calculate/weekOfYearForDateTime.js +30 -29
- package/dist/plain/chop/chopDate.d.ts +1 -1
- package/dist/plain/chop/chopDate.js +24 -22
- package/dist/plain/chop/chopMilliseconds.d.ts +1 -1
- package/dist/plain/chop/chopMilliseconds.js +28 -32
- package/dist/plain/chop/chopSeconds.d.ts +1 -1
- package/dist/plain/chop/chopSeconds.js +28 -32
- package/dist/plain/chop/chopTime.d.ts +1 -1
- package/dist/plain/chop/chopTime.js +24 -22
- package/dist/plain/chop/index.d.ts +5 -4
- package/dist/plain/chop/index.js +6 -4
- package/dist/plain/compare/areDateTimesEqual.d.ts +1 -1
- package/dist/plain/compare/areDateTimesEqual.js +28 -35
- package/dist/plain/compare/areDateTimesEqualBy.d.ts +11 -13
- package/dist/plain/compare/areDateTimesEqualBy.js +61 -70
- package/dist/plain/compare/areDatesEqual.d.ts +1 -1
- package/dist/plain/compare/areDatesEqual.js +30 -31
- package/dist/plain/compare/areDatesEqualBy.d.ts +14 -14
- package/dist/plain/compare/areDatesEqualBy.js +67 -77
- package/dist/plain/compare/areMonthDaysEqual.d.ts +16 -0
- package/dist/plain/compare/areMonthDaysEqual.js +30 -0
- package/dist/plain/compare/areTimesEqual.d.ts +1 -1
- package/dist/plain/compare/areTimesEqual.js +31 -35
- package/dist/plain/compare/areYearMonthsEqual.d.ts +15 -0
- package/dist/plain/compare/areYearMonthsEqual.js +29 -0
- package/dist/plain/compare/compareMonthDays.d.ts +20 -0
- package/dist/plain/compare/compareMonthDays.js +36 -0
- package/dist/plain/compare/compareYearMonths.d.ts +18 -0
- package/dist/plain/compare/compareYearMonths.js +33 -0
- package/dist/plain/compare/index.d.ts +25 -20
- package/dist/plain/compare/index.js +26 -20
- package/dist/plain/compare/isAfterDate.d.ts +1 -1
- package/dist/plain/compare/isAfterDate.js +27 -26
- package/dist/plain/compare/isAfterDateTime.d.ts +1 -1
- package/dist/plain/compare/isAfterDateTime.js +28 -27
- package/dist/plain/compare/isAfterTime.d.ts +1 -1
- package/dist/plain/compare/isAfterTime.js +28 -27
- package/dist/plain/compare/isBeforeDate.d.ts +1 -1
- package/dist/plain/compare/isBeforeDate.js +28 -27
- package/dist/plain/compare/isBeforeDateTime.d.ts +1 -1
- package/dist/plain/compare/isBeforeDateTime.js +28 -27
- package/dist/plain/compare/isBeforeTime.d.ts +1 -1
- package/dist/plain/compare/isBeforeTime.js +28 -27
- package/dist/plain/compare/isBetweenDate.d.ts +15 -15
- package/dist/plain/compare/isBetweenDate.js +46 -61
- package/dist/plain/compare/isBetweenDateTime.d.ts +15 -15
- package/dist/plain/compare/isBetweenDateTime.js +46 -63
- package/dist/plain/compare/isBetweenTime.d.ts +15 -15
- package/dist/plain/compare/isBetweenTime.js +48 -63
- package/dist/plain/compare/isBusinessDay.d.ts +5 -4
- package/dist/plain/compare/isBusinessDay.js +51 -52
- package/dist/plain/compare/isFuture.d.ts +1 -1
- package/dist/plain/compare/isFuture.js +30 -30
- package/dist/plain/compare/isPast.d.ts +1 -1
- package/dist/plain/compare/isPast.js +30 -30
- package/dist/plain/compare/isRelativeDay.d.ts +2 -2
- package/dist/plain/compare/isRelativeDay.js +43 -45
- package/dist/plain/compare/isThisUnit.d.ts +9 -7
- package/dist/plain/compare/isThisUnit.js +65 -67
- package/dist/plain/compare/isWeekend.d.ts +6 -6
- package/dist/plain/compare/isWeekend.js +40 -39
- package/dist/plain/convert/convertDateToCalendar.d.ts +3 -2
- package/dist/plain/convert/convertDateToCalendar.js +59 -58
- package/dist/plain/convert/index.d.ts +3 -1
- package/dist/plain/convert/index.js +4 -1
- package/dist/plain/convert/monthDayToDate.d.ts +23 -0
- package/dist/plain/convert/monthDayToDate.js +37 -0
- package/dist/plain/format/formatCalendar.d.ts +15 -16
- package/dist/plain/format/formatCalendar.js +73 -94
- package/dist/plain/format/formatDate.d.ts +7 -6
- package/dist/plain/format/formatDate.js +53 -61
- package/dist/plain/format/formatDateRange.d.ts +7 -6
- package/dist/plain/format/formatDateRange.js +50 -55
- package/dist/plain/format/formatDateTime.d.ts +7 -6
- package/dist/plain/format/formatDateTime.js +51 -55
- package/dist/plain/format/formatDateTimeRange.d.ts +7 -6
- package/dist/plain/format/formatDateTimeRange.js +51 -55
- package/dist/plain/format/formatDateTimeToParts.d.ts +20 -19
- package/dist/plain/format/formatDateTimeToParts.js +71 -74
- package/dist/plain/format/formatDateToParts.d.ts +20 -19
- package/dist/plain/format/formatDateToParts.js +67 -72
- package/dist/plain/format/formatMonthDay.d.ts +40 -0
- package/dist/plain/format/formatMonthDay.js +74 -0
- package/dist/plain/format/formatRelativeDate.d.ts +17 -15
- package/dist/plain/format/formatRelativeDate.js +76 -77
- package/dist/plain/format/formatRelativeDateTime.d.ts +16 -14
- package/dist/plain/format/formatRelativeDateTime.js +51 -60
- package/dist/plain/format/formatRelativeTime.d.ts +17 -15
- package/dist/plain/format/formatRelativeTime.js +64 -66
- package/dist/plain/format/formatSqlDateTime.d.ts +4 -3
- package/dist/plain/format/formatSqlDateTime.js +39 -38
- package/dist/plain/format/formatTime.d.ts +7 -6
- package/dist/plain/format/formatTime.js +49 -56
- package/dist/plain/format/formatYearMonth.d.ts +42 -0
- package/dist/plain/format/formatYearMonth.js +75 -0
- package/dist/plain/format/index.d.ts +15 -12
- package/dist/plain/format/index.js +16 -12
- package/dist/plain/get/getDateAgo.d.ts +29 -0
- package/dist/plain/get/getDateAgo.js +48 -0
- package/dist/plain/get/getDateIn.d.ts +29 -0
- package/dist/plain/get/getDateIn.js +47 -0
- package/dist/plain/get/getDateTimeAgo.d.ts +28 -0
- package/dist/plain/get/getDateTimeAgo.js +47 -0
- package/dist/plain/get/getDateTimeIn.d.ts +28 -0
- package/dist/plain/get/getDateTimeIn.js +47 -0
- package/dist/plain/get/getDay.d.ts +2 -2
- package/dist/plain/get/getDay.js +24 -24
- package/dist/plain/get/getDayOfWeek.d.ts +2 -2
- package/dist/plain/get/getDayOfWeek.js +24 -23
- package/dist/plain/get/getHour.d.ts +2 -2
- package/dist/plain/get/getHour.js +24 -24
- package/dist/plain/get/getMicrosecond.d.ts +2 -2
- package/dist/plain/get/getMicrosecond.js +24 -24
- package/dist/plain/get/getMillisecond.d.ts +2 -2
- package/dist/plain/get/getMillisecond.js +24 -24
- package/dist/plain/get/getMinute.d.ts +2 -2
- package/dist/plain/get/getMinute.js +24 -24
- package/dist/plain/get/getMonth.d.ts +2 -2
- package/dist/plain/get/getMonth.js +24 -24
- package/dist/plain/get/getNanosecond.d.ts +2 -2
- package/dist/plain/get/getNanosecond.js +24 -24
- package/dist/plain/get/getNow.d.ts +2 -2
- package/dist/plain/get/getNow.js +22 -21
- package/dist/plain/get/getNowUnit.d.ts +4 -3
- package/dist/plain/get/getNowUnit.js +52 -53
- package/dist/plain/get/getSecond.d.ts +2 -2
- package/dist/plain/get/getSecond.js +24 -24
- package/dist/plain/get/getTimeAgo.d.ts +27 -0
- package/dist/plain/get/getTimeAgo.js +46 -0
- package/dist/plain/get/getTimeIn.d.ts +27 -0
- package/dist/plain/get/getTimeIn.js +46 -0
- package/dist/plain/get/getToday.d.ts +2 -2
- package/dist/plain/get/getToday.js +22 -21
- package/dist/plain/get/getWeekOfYear.d.ts +2 -2
- package/dist/plain/get/getWeekOfYear.js +30 -29
- package/dist/plain/get/getYear.d.ts +2 -2
- package/dist/plain/get/getYear.js +27 -25
- package/dist/plain/get/index.d.ts +22 -14
- package/dist/plain/get/index.js +22 -14
- package/dist/plain/index.d.ts +264 -12
- package/dist/plain/index.js +256 -13
- package/dist/plain/interval/index.d.ts +54 -51
- package/dist/plain/interval/index.js +55 -51
- package/dist/plain/interval/intervalAbutsDate.d.ts +2 -3
- package/dist/plain/interval/intervalAbutsDate.js +56 -62
- package/dist/plain/interval/intervalAbutsDateTime.d.ts +1 -1
- package/dist/plain/interval/intervalAbutsDateTime.js +49 -55
- package/dist/plain/interval/intervalAbutsTime.d.ts +1 -1
- package/dist/plain/interval/intervalAbutsTime.js +53 -59
- package/dist/plain/interval/intervalContainsDate.d.ts +2 -2
- package/dist/plain/interval/intervalContainsDate.js +63 -66
- package/dist/plain/interval/intervalContainsDateTime.d.ts +1 -1
- package/dist/plain/interval/intervalContainsDateTime.js +58 -62
- package/dist/plain/interval/intervalContainsTime.d.ts +1 -1
- package/dist/plain/interval/intervalContainsTime.js +63 -67
- package/dist/plain/interval/intervalCountDate.d.ts +1 -1
- package/dist/plain/interval/intervalCountDate.js +70 -89
- package/dist/plain/interval/intervalCountDateTime.d.ts +1 -1
- package/dist/plain/interval/intervalCountDateTime.js +86 -107
- package/dist/plain/interval/intervalCountTime.d.ts +1 -1
- package/dist/plain/interval/intervalCountTime.js +56 -65
- package/dist/plain/interval/intervalDifferenceDate.d.ts +13 -13
- package/dist/plain/interval/intervalDifferenceDate.js +72 -72
- package/dist/plain/interval/intervalDifferenceDateTime.d.ts +12 -12
- package/dist/plain/interval/intervalDifferenceDateTime.js +55 -61
- package/dist/plain/interval/intervalDifferenceTime.d.ts +12 -12
- package/dist/plain/interval/intervalDifferenceTime.js +57 -63
- package/dist/plain/interval/intervalDivideEquallyDate.d.ts +23 -23
- package/dist/plain/interval/intervalDivideEquallyDate.js +76 -89
- package/dist/plain/interval/intervalDivideEquallyDateTime.d.ts +20 -20
- package/dist/plain/interval/intervalDivideEquallyDateTime.js +73 -92
- package/dist/plain/interval/intervalDivideEquallyTime.d.ts +20 -20
- package/dist/plain/interval/intervalDivideEquallyTime.js +67 -85
- package/dist/plain/interval/intervalEngulfsDate.d.ts +2 -2
- package/dist/plain/interval/intervalEngulfsDate.js +57 -62
- package/dist/plain/interval/intervalEngulfsDateTime.d.ts +1 -1
- package/dist/plain/interval/intervalEngulfsDateTime.js +52 -58
- package/dist/plain/interval/intervalEngulfsTime.d.ts +1 -1
- package/dist/plain/interval/intervalEngulfsTime.js +57 -63
- package/dist/plain/interval/intervalFromDurationDate.d.ts +21 -20
- package/dist/plain/interval/intervalFromDurationDate.js +64 -69
- package/dist/plain/interval/intervalFromDurationDateTime.d.ts +21 -20
- package/dist/plain/interval/intervalFromDurationDateTime.js +51 -57
- package/dist/plain/interval/intervalFromDurationTime.d.ts +12 -12
- package/dist/plain/interval/intervalFromDurationTime.js +61 -75
- package/dist/plain/interval/intervalIntersectionDate.d.ts +13 -13
- package/dist/plain/interval/intervalIntersectionDate.js +71 -73
- package/dist/plain/interval/intervalIntersectionDateTime.d.ts +12 -12
- package/dist/plain/interval/intervalIntersectionDateTime.js +56 -61
- package/dist/plain/interval/intervalIntersectionTime.d.ts +12 -12
- package/dist/plain/interval/intervalIntersectionTime.js +56 -61
- package/dist/plain/interval/intervalLengthDate.d.ts +1 -1
- package/dist/plain/interval/intervalLengthDate.js +71 -79
- package/dist/plain/interval/intervalLengthDateTime.d.ts +1 -1
- package/dist/plain/interval/intervalLengthDateTime.js +44 -48
- package/dist/plain/interval/intervalLengthTime.d.ts +1 -1
- package/dist/plain/interval/intervalLengthTime.js +41 -47
- package/dist/plain/interval/intervalOverlappingDaysDate.d.ts +1 -1
- package/dist/plain/interval/intervalOverlappingDaysDate.js +67 -76
- package/dist/plain/interval/intervalOverlappingDaysDateTime.d.ts +1 -1
- package/dist/plain/interval/intervalOverlappingDaysDateTime.js +52 -65
- package/dist/plain/interval/intervalSplitAtDate.d.ts +13 -13
- package/dist/plain/interval/intervalSplitAtDate.js +80 -85
- package/dist/plain/interval/intervalSplitAtDateTime.d.ts +12 -12
- package/dist/plain/interval/intervalSplitAtDateTime.js +65 -74
- package/dist/plain/interval/intervalSplitAtTime.d.ts +12 -12
- package/dist/plain/interval/intervalSplitAtTime.js +67 -76
- package/dist/plain/interval/intervalUnionDate.d.ts +14 -14
- package/dist/plain/interval/intervalUnionDate.js +75 -77
- package/dist/plain/interval/intervalUnionDateTime.d.ts +12 -12
- package/dist/plain/interval/intervalUnionDateTime.js +59 -64
- package/dist/plain/interval/intervalUnionTime.d.ts +12 -12
- package/dist/plain/interval/intervalUnionTime.js +59 -64
- package/dist/plain/interval/intervalXorAllDate.d.ts +15 -15
- package/dist/plain/interval/intervalXorAllDate.js +59 -64
- package/dist/plain/interval/intervalXorAllDateTime.d.ts +14 -14
- package/dist/plain/interval/intervalXorAllDateTime.js +49 -54
- package/dist/plain/interval/intervalXorAllTime.d.ts +14 -14
- package/dist/plain/interval/intervalXorAllTime.js +50 -55
- package/dist/plain/interval/intervalXorDate.d.ts +13 -13
- package/dist/plain/interval/intervalXorDate.js +66 -69
- package/dist/plain/interval/intervalXorDateTime.d.ts +12 -12
- package/dist/plain/interval/intervalXorDateTime.js +52 -61
- package/dist/plain/interval/intervalXorTime.d.ts +12 -12
- package/dist/plain/interval/intervalXorTime.js +52 -61
- package/dist/plain/interval/intervalsOverlapDate.d.ts +2 -2
- package/dist/plain/interval/intervalsOverlapDate.js +56 -61
- package/dist/plain/interval/intervalsOverlapDateTime.d.ts +1 -1
- package/dist/plain/interval/intervalsOverlapDateTime.js +50 -56
- package/dist/plain/interval/intervalsOverlapTime.d.ts +1 -1
- package/dist/plain/interval/intervalsOverlapTime.js +51 -57
- package/dist/plain/interval/mergeIntervalsDate.d.ts +15 -15
- package/dist/plain/interval/mergeIntervalsDate.js +58 -63
- package/dist/plain/interval/mergeIntervalsDateTime.d.ts +14 -14
- package/dist/plain/interval/mergeIntervalsDateTime.js +48 -54
- package/dist/plain/interval/mergeIntervalsTime.d.ts +14 -14
- package/dist/plain/interval/mergeIntervalsTime.js +48 -54
- package/dist/plain/interval/splitIntervalByUnitDate.d.ts +22 -23
- package/dist/plain/interval/splitIntervalByUnitDate.js +86 -110
- package/dist/plain/interval/splitIntervalByUnitDateTime.d.ts +22 -21
- package/dist/plain/interval/splitIntervalByUnitDateTime.js +77 -95
- package/dist/plain/interval/splitIntervalByUnitTime.d.ts +20 -20
- package/dist/plain/interval/splitIntervalByUnitTime.js +79 -104
- package/dist/plain/interval/validate/index.d.ts +4 -3
- package/dist/plain/interval/validate/index.js +5 -3
- package/dist/plain/interval/validate/isValidDateInterval.d.ts +2 -2
- package/dist/plain/interval/validate/isValidDateInterval.js +36 -37
- package/dist/plain/interval/validate/isValidDateTimeInterval.d.ts +1 -1
- package/dist/plain/interval/validate/isValidDateTimeInterval.js +35 -36
- package/dist/plain/interval/validate/isValidTimeInterval.d.ts +1 -1
- package/dist/plain/interval/validate/isValidTimeInterval.js +35 -36
- package/dist/plain/locale/getLocaleEraNames.d.ts +8 -8
- package/dist/plain/locale/getLocaleEraNames.js +69 -78
- package/dist/plain/locale/getLocaleMeridiems.d.ts +6 -6
- package/dist/plain/locale/getLocaleMeridiems.js +42 -47
- package/dist/plain/locale/getLocaleMonthNames.d.ts +7 -7
- package/dist/plain/locale/getLocaleMonthNames.js +57 -57
- package/dist/plain/locale/getLocaleWeekdayNames.d.ts +5 -5
- package/dist/plain/locale/getLocaleWeekdayNames.js +58 -62
- package/dist/plain/locale/index.d.ts +5 -4
- package/dist/plain/locale/index.js +6 -4
- package/dist/plain/map/index.d.ts +3 -2
- package/dist/plain/map/index.js +4 -2
- package/dist/plain/map/mapDatesInRange.d.ts +9 -9
- package/dist/plain/map/mapDatesInRange.js +57 -76
- package/dist/plain/map/mapDaysInMonth.d.ts +1 -1
- package/dist/plain/map/mapDaysInMonth.js +30 -29
- package/dist/plain/parse/index.d.ts +38 -29
- package/dist/plain/parse/index.js +39 -29
- package/dist/plain/parse/parseDateTimeWithPattern.d.ts +23 -18
- package/dist/plain/parse/parseDateTimeWithPattern.js +134 -138
- package/dist/plain/parse/parseDateWithPattern.d.ts +27 -22
- package/dist/plain/parse/parseDateWithPattern.js +114 -114
- package/dist/plain/parse/parseDayFromDate.d.ts +1 -1
- package/dist/plain/parse/parseDayFromDate.js +24 -23
- package/dist/plain/parse/parseDayFromDateTime.d.ts +1 -1
- package/dist/plain/parse/parseDayFromDateTime.js +25 -24
- package/dist/plain/parse/parseDayOfWeekFromDate.d.ts +1 -1
- package/dist/plain/parse/parseDayOfWeekFromDate.js +26 -26
- package/dist/plain/parse/parseDayOfWeekFromDateTime.d.ts +1 -1
- package/dist/plain/parse/parseDayOfWeekFromDateTime.js +25 -25
- package/dist/plain/parse/parseHourFromDateTime.d.ts +1 -1
- package/dist/plain/parse/parseHourFromDateTime.js +25 -24
- package/dist/plain/parse/parseHourFromTime.d.ts +1 -1
- package/dist/plain/parse/parseHourFromTime.js +24 -23
- package/dist/plain/parse/parseMicrosecondFromDateTime.d.ts +1 -1
- package/dist/plain/parse/parseMicrosecondFromDateTime.js +26 -25
- package/dist/plain/parse/parseMicrosecondFromTime.d.ts +1 -1
- package/dist/plain/parse/parseMicrosecondFromTime.js +23 -22
- package/dist/plain/parse/parseMillisecondFromDateTime.d.ts +1 -1
- package/dist/plain/parse/parseMillisecondFromDateTime.js +25 -24
- package/dist/plain/parse/parseMillisecondFromTime.d.ts +1 -1
- package/dist/plain/parse/parseMillisecondFromTime.js +25 -24
- package/dist/plain/parse/parseMinuteFromDateTime.d.ts +1 -1
- package/dist/plain/parse/parseMinuteFromDateTime.js +25 -24
- package/dist/plain/parse/parseMinuteFromTime.d.ts +1 -1
- package/dist/plain/parse/parseMinuteFromTime.js +25 -24
- package/dist/plain/parse/parseMonthDay.d.ts +21 -0
- package/dist/plain/parse/parseMonthDay.js +30 -0
- package/dist/plain/parse/parseMonthDayFromDate.d.ts +16 -0
- package/dist/plain/parse/parseMonthDayFromDate.js +30 -0
- package/dist/plain/parse/parseMonthDayFromDateTime.d.ts +19 -0
- package/dist/plain/parse/parseMonthDayFromDateTime.js +33 -0
- package/dist/plain/parse/parseMonthDayWithPattern.d.ts +56 -0
- package/dist/plain/parse/parseMonthDayWithPattern.js +77 -0
- package/dist/plain/parse/parseMonthFromDate.d.ts +1 -1
- package/dist/plain/parse/parseMonthFromDate.js +24 -23
- package/dist/plain/parse/parseMonthFromDateTime.d.ts +1 -1
- package/dist/plain/parse/parseMonthFromDateTime.js +24 -23
- package/dist/plain/parse/parseNanosecondFromDateTime.d.ts +1 -1
- package/dist/plain/parse/parseNanosecondFromDateTime.js +26 -25
- package/dist/plain/parse/parseNanosecondFromTime.d.ts +1 -1
- package/dist/plain/parse/parseNanosecondFromTime.js +26 -25
- package/dist/plain/parse/parseSecondFromDateTime.d.ts +1 -1
- package/dist/plain/parse/parseSecondFromDateTime.js +25 -24
- package/dist/plain/parse/parseSecondFromTime.d.ts +1 -1
- package/dist/plain/parse/parseSecondFromTime.js +25 -24
- package/dist/plain/parse/parseSqlDateTime.d.ts +3 -3
- package/dist/plain/parse/parseSqlDateTime.js +31 -37
- package/dist/plain/parse/parseTimeWithPattern.d.ts +7 -5
- package/dist/plain/parse/parseTimeWithPattern.js +86 -93
- package/dist/plain/parse/parseUnitFromDate.d.ts +11 -11
- package/dist/plain/parse/parseUnitFromDate.js +57 -68
- package/dist/plain/parse/parseUnitFromDateTime.d.ts +11 -11
- package/dist/plain/parse/parseUnitFromDateTime.js +63 -81
- package/dist/plain/parse/parseUnitFromTime.d.ts +2 -2
- package/dist/plain/parse/parseUnitFromTime.js +43 -49
- package/dist/plain/parse/parseWeekFromDate.d.ts +10 -10
- package/dist/plain/parse/parseWeekFromDate.js +36 -41
- package/dist/plain/parse/parseWeekFromDateTime.d.ts +10 -10
- package/dist/plain/parse/parseWeekFromDateTime.js +36 -42
- package/dist/plain/parse/parseYearFromDate.d.ts +1 -1
- package/dist/plain/parse/parseYearFromDate.js +28 -26
- package/dist/plain/parse/parseYearFromDateTime.d.ts +1 -1
- package/dist/plain/parse/parseYearFromDateTime.js +27 -25
- package/dist/plain/parse/parseYearMonth.d.ts +25 -0
- package/dist/plain/parse/parseYearMonth.js +34 -0
- package/dist/plain/parse/parseYearMonthFromDate.d.ts +17 -0
- package/dist/plain/parse/parseYearMonthFromDate.js +31 -0
- package/dist/plain/parse/parseYearMonthFromDateTime.d.ts +18 -0
- package/dist/plain/parse/parseYearMonthFromDateTime.js +32 -0
- package/dist/plain/parse/parseYearMonthWithPattern.d.ts +44 -0
- package/dist/plain/parse/parseYearMonthWithPattern.js +66 -0
- package/dist/plain/validate/{isLeapSecond.d.ts → hasSecond60.d.ts} +16 -14
- package/dist/plain/validate/hasSecond60.js +44 -0
- package/dist/plain/validate/index.d.ts +23 -20
- package/dist/plain/validate/index.js +24 -20
- package/dist/plain/validate/isLeapYear.d.ts +1 -1
- package/dist/plain/validate/isLeapYear.js +30 -29
- package/dist/plain/validate/isValidCalendarDate.d.ts +6 -2
- package/dist/plain/validate/isValidCalendarDate.js +13 -59
- package/dist/plain/validate/isValidDate.d.ts +6 -1
- package/dist/plain/validate/isValidDate.js +7 -41
- package/dist/plain/validate/isValidDateCycleField.d.ts +3 -2
- package/dist/plain/validate/isValidDateCycleField.js +24 -23
- package/dist/plain/validate/isValidDateDurationUnit.d.ts +7 -4
- package/dist/plain/validate/isValidDateDurationUnit.js +20 -15
- package/dist/plain/validate/isValidDateRange.d.ts +21 -21
- package/dist/plain/validate/isValidDateRange.js +38 -50
- package/dist/plain/validate/isValidDateTime.d.ts +7 -2
- package/dist/plain/validate/isValidDateTime.js +7 -39
- package/dist/plain/validate/isValidDateTimeCycleField.d.ts +3 -2
- package/dist/plain/validate/isValidDateTimeCycleField.js +19 -15
- package/dist/plain/validate/isValidDateTimeDurationUnit.d.ts +7 -4
- package/dist/plain/validate/isValidDateTimeDurationUnit.js +20 -24
- package/dist/plain/validate/isValidDateTimeRange.d.ts +21 -21
- package/dist/plain/validate/isValidDateTimeRange.js +39 -48
- package/dist/plain/validate/isValidDateTimeUnit.d.ts +3 -2
- package/dist/plain/validate/isValidDateTimeUnit.js +22 -30
- package/dist/plain/validate/isValidDateUnit.d.ts +3 -2
- package/dist/plain/validate/isValidDateUnit.js +24 -23
- package/dist/plain/validate/isValidIsoDateLike.d.ts +6 -1
- package/dist/plain/validate/isValidIsoDateLike.js +23 -46
- package/dist/plain/validate/isValidMonthDay.d.ts +32 -0
- package/dist/plain/validate/isValidMonthDay.js +8 -0
- package/dist/plain/validate/isValidSqlDateTime.d.ts +9 -5
- package/dist/plain/validate/isValidSqlDateTime.js +7 -35
- package/dist/plain/validate/isValidTime.d.ts +6 -1
- package/dist/plain/validate/isValidTime.js +7 -39
- package/dist/plain/validate/isValidTimeCycleField.d.ts +3 -2
- package/dist/plain/validate/isValidTimeCycleField.js +21 -25
- package/dist/plain/validate/isValidTimeDurationUnit.d.ts +7 -4
- package/dist/plain/validate/isValidTimeDurationUnit.js +20 -20
- package/dist/plain/validate/isValidTimeRange.d.ts +21 -21
- package/dist/plain/validate/isValidTimeRange.js +40 -49
- package/dist/plain/validate/isValidTimeUnit.d.ts +3 -2
- package/dist/plain/validate/isValidTimeUnit.js +22 -26
- package/dist/plain/validate/isValidYearMonth.d.ts +34 -0
- package/dist/plain/validate/isValidYearMonth.js +8 -0
- package/dist/precision/calculate/index.d.ts +2 -1
- package/dist/precision/calculate/index.js +3 -1
- package/dist/precision/calculate/truncateNanoseconds.d.ts +1 -1
- package/dist/precision/calculate/truncateNanoseconds.js +36 -37
- package/dist/precision/convert/fromArrowLocalTimestamp.d.ts +29 -0
- package/dist/precision/convert/fromArrowLocalTimestamp.js +35 -0
- package/dist/precision/convert/fromArrowTimestamp.d.ts +31 -0
- package/dist/precision/convert/fromArrowTimestamp.js +34 -0
- package/dist/precision/convert/fromDotNetTicks.d.ts +1 -1
- package/dist/precision/convert/fromDotNetTicks.js +36 -36
- package/dist/precision/convert/fromExcelSerial.d.ts +11 -11
- package/dist/precision/convert/fromExcelSerial.js +55 -76
- package/dist/precision/convert/fromFileTime.d.ts +1 -1
- package/dist/precision/convert/fromFileTime.js +36 -36
- package/dist/precision/convert/fromNanoseconds.d.ts +3 -3
- package/dist/precision/convert/fromNanoseconds.js +49 -54
- package/dist/precision/convert/fromNtpTimestamp.d.ts +1 -1
- package/dist/precision/convert/fromNtpTimestamp.js +54 -54
- package/dist/precision/convert/fromParquetInt96.d.ts +34 -0
- package/dist/precision/convert/fromParquetInt96.js +55 -0
- package/dist/precision/convert/fromPgMicroseconds.d.ts +1 -1
- package/dist/precision/convert/fromPgMicroseconds.js +32 -30
- package/dist/precision/convert/fromProtoDuration.d.ts +31 -0
- package/dist/precision/convert/fromProtoDuration.js +47 -0
- package/dist/precision/convert/fromProtoTimestamp.d.ts +30 -0
- package/dist/precision/convert/fromProtoTimestamp.js +39 -0
- package/dist/precision/convert/index.d.ts +23 -12
- package/dist/precision/convert/index.js +24 -12
- package/dist/precision/convert/toArrowLocalTimestamp.d.ts +36 -0
- package/dist/precision/convert/toArrowLocalTimestamp.js +42 -0
- package/dist/precision/convert/toArrowTimestamp.d.ts +32 -0
- package/dist/precision/convert/toArrowTimestamp.js +39 -0
- package/dist/precision/convert/toDotNetTicks.d.ts +1 -1
- package/dist/precision/convert/toDotNetTicks.js +40 -38
- package/dist/precision/convert/toExcelSerial.d.ts +10 -10
- package/dist/precision/convert/toExcelSerial.js +61 -80
- package/dist/precision/convert/toFileTime.d.ts +1 -1
- package/dist/precision/convert/toFileTime.js +42 -41
- package/dist/precision/convert/toNanoseconds.d.ts +3 -3
- package/dist/precision/convert/toNanoseconds.js +47 -43
- package/dist/precision/convert/toNtpTimestamp.d.ts +1 -1
- package/dist/precision/convert/toNtpTimestamp.js +39 -36
- package/dist/precision/convert/toParquetInt96.d.ts +42 -0
- package/dist/precision/convert/toParquetInt96.js +44 -0
- package/dist/precision/convert/toPgMicroseconds.d.ts +1 -1
- package/dist/precision/convert/toPgMicroseconds.js +40 -40
- package/dist/precision/convert/toProtoDuration.d.ts +41 -0
- package/dist/precision/convert/toProtoDuration.js +42 -0
- package/dist/precision/convert/toProtoTimestamp.d.ts +41 -0
- package/dist/precision/convert/toProtoTimestamp.js +42 -0
- package/dist/precision/format/formatNanoseconds.d.ts +1 -1
- package/dist/precision/format/formatNanoseconds.js +32 -30
- package/dist/precision/format/index.d.ts +2 -1
- package/dist/precision/format/index.js +3 -1
- package/dist/precision/identifiers/fromKsuid.d.ts +28 -0
- package/dist/precision/identifiers/fromKsuid.js +41 -0
- package/dist/precision/identifiers/fromObjectId.d.ts +32 -0
- package/dist/precision/identifiers/fromObjectId.js +43 -0
- package/dist/precision/identifiers/fromSnowflake.d.ts +44 -0
- package/dist/precision/identifiers/fromSnowflake.js +48 -0
- package/dist/precision/identifiers/fromUlid.d.ts +33 -0
- package/dist/precision/identifiers/fromUlid.js +44 -0
- package/dist/precision/identifiers/fromUuidTimestamp.d.ts +34 -0
- package/dist/precision/identifiers/fromUuidTimestamp.js +50 -0
- package/dist/precision/identifiers/index.d.ts +8 -0
- package/dist/precision/identifiers/index.js +9 -0
- package/dist/precision/identifiers/ulidTimestampPrefix.d.ts +36 -0
- package/dist/precision/identifiers/ulidTimestampPrefix.js +45 -0
- package/dist/precision/identifiers/uuidV7TimestampPrefix.d.ts +34 -0
- package/dist/precision/identifiers/uuidV7TimestampPrefix.js +44 -0
- package/dist/precision/index.d.ts +39 -6
- package/dist/precision/index.js +40 -7
- package/dist/precision/parse/index.d.ts +2 -1
- package/dist/precision/parse/index.js +3 -1
- package/dist/precision/parse/parseNanoseconds.d.ts +1 -1
- package/dist/precision/parse/parseNanoseconds.js +31 -29
- package/dist/precision/validate/index.d.ts +6 -3
- package/dist/precision/validate/index.js +7 -3
- package/dist/precision/validate/isValidInstant.d.ts +8 -3
- package/dist/precision/validate/isValidInstant.js +7 -48
- package/dist/precision/validate/isValidInt64NanosecondDateTime.d.ts +29 -0
- package/dist/precision/validate/isValidInt64NanosecondDateTime.js +8 -0
- package/dist/precision/validate/isValidInt64NanosecondInstant.d.ts +29 -0
- package/dist/precision/validate/isValidInt64NanosecondInstant.js +9 -0
- package/dist/precision/validate/isValidNanoPattern.d.ts +6 -2
- package/dist/precision/validate/isValidNanoPattern.js +9 -38
- package/dist/precision/validate/isValidNanoseconds.d.ts +1 -1
- package/dist/precision/validate/isValidNanoseconds.js +30 -26
- package/dist/recurrence/calculate/cronRuns.d.ts +61 -0
- package/dist/recurrence/calculate/cronRuns.js +261 -0
- package/dist/recurrence/calculate/expandRecurrence.d.ts +64 -0
- package/dist/recurrence/calculate/expandRecurrence.js +391 -0
- package/dist/recurrence/calculate/index.d.ts +3 -0
- package/dist/recurrence/calculate/index.js +4 -0
- package/dist/recurrence/index.d.ts +8 -0
- package/dist/recurrence/index.js +7 -0
- package/dist/recurrence/parse/index.d.ts +3 -0
- package/dist/recurrence/parse/index.js +4 -0
- package/dist/recurrence/parse/parseCronExpression.d.ts +31 -0
- package/dist/recurrence/parse/parseCronExpression.js +41 -0
- package/dist/recurrence/parse/parseRecurrenceRule.d.ts +34 -0
- package/dist/recurrence/parse/parseRecurrenceRule.js +43 -0
- package/dist/regex/calendar-date.d.ts +1 -1
- package/dist/regex/calendar-date.js +33 -30
- package/dist/regex/calendar-zoned-date-time.d.ts +5 -5
- package/dist/regex/calendar-zoned-date-time.js +32 -29
- package/dist/regex/date-time.d.ts +1 -1
- package/dist/regex/date-time.js +31 -28
- package/dist/regex/date.d.ts +1 -1
- package/dist/regex/date.js +61 -58
- package/dist/regex/epcis.d.ts +1 -1
- package/dist/regex/epcis.js +61 -58
- package/dist/regex/http-date.d.ts +1 -1
- package/dist/regex/http-date.js +24 -21
- package/dist/regex/index.d.ts +21 -17
- package/dist/regex/index.js +22 -18
- package/dist/regex/leap-second.d.ts +2 -2
- package/dist/regex/leap-second.js +47 -44
- package/dist/regex/month-day.d.ts +22 -0
- package/dist/regex/month-day.js +25 -0
- package/dist/regex/nanoseconds.d.ts +1 -1
- package/dist/regex/nanoseconds.js +22 -19
- package/dist/regex/rfc-2822.d.ts +1 -1
- package/dist/regex/rfc-2822.js +31 -28
- package/dist/regex/rfc-3339.d.ts +1 -1
- package/dist/regex/rfc-3339.js +31 -28
- package/dist/regex/sql-date-time.d.ts +4 -3
- package/dist/regex/sql-date-time.js +38 -34
- package/dist/regex/sql-offset-date-time.d.ts +52 -0
- package/dist/regex/sql-offset-date-time.js +55 -0
- package/dist/regex/time-zone-like.d.ts +3 -3
- package/dist/regex/time-zone-like.js +34 -31
- package/dist/regex/time.d.ts +1 -1
- package/dist/regex/time.js +76 -73
- package/dist/regex/unix.d.ts +1 -1
- package/dist/regex/unix.js +32 -29
- package/dist/regex/utc-date-time.d.ts +1 -1
- package/dist/regex/utc-date-time.js +33 -30
- package/dist/regex/utc-offset.d.ts +1 -1
- package/dist/regex/utc-offset.js +27 -24
- package/dist/regex/year-month.d.ts +22 -0
- package/dist/regex/year-month.js +25 -0
- package/dist/span/calculate/index.d.ts +5 -3
- package/dist/span/calculate/index.js +6 -3
- package/dist/span/calculate/spanMs.d.ts +5 -4
- package/dist/span/calculate/spanMs.js +75 -79
- package/dist/span/calculate/spanNs.d.ts +5 -4
- package/dist/span/calculate/spanNs.js +58 -55
- package/dist/span/calculate/spanSeconds.d.ts +32 -0
- package/dist/span/calculate/spanSeconds.js +45 -0
- package/dist/span/calculate/spanWallClock.d.ts +13 -13
- package/dist/span/calculate/spanWallClock.js +69 -76
- package/dist/span/index.d.ts +7 -3
- package/dist/span/index.js +8 -4
- package/dist/span/validate/index.d.ts +2 -1
- package/dist/span/validate/index.js +3 -1
- package/dist/span/validate/isValidSpan.d.ts +4 -4
- package/dist/span/validate/isValidSpan.js +47 -44
- package/dist/timescale/calculate/index.d.ts +4 -0
- package/dist/timescale/calculate/index.js +5 -0
- package/dist/timescale/calculate/leapSecondsBetween.d.ts +26 -0
- package/dist/timescale/calculate/leapSecondsBetween.js +57 -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 +38 -0
- package/dist/timescale/convert/index.d.ts +3 -0
- package/dist/timescale/convert/index.js +4 -0
- package/dist/timescale/convert/toTAI.d.ts +23 -0
- package/dist/timescale/convert/toTAI.js +43 -0
- package/dist/timescale/index.d.ts +8 -0
- package/dist/timescale/index.js +9 -0
- package/dist/timescale/validate/index.d.ts +2 -0
- package/dist/timescale/validate/index.js +3 -0
- package/dist/timescale/validate/isLeapSecond.d.ts +25 -0
- package/dist/timescale/validate/isLeapSecond.js +38 -0
- package/dist/transport/calculate/bestAvailable.d.ts +7 -6
- package/dist/transport/calculate/bestAvailable.js +75 -73
- package/dist/transport/calculate/crossingTime.d.ts +12 -12
- package/dist/transport/calculate/crossingTime.js +70 -78
- package/dist/transport/calculate/cutoffAt.d.ts +33 -31
- package/dist/transport/calculate/cutoffAt.js +88 -208
- package/dist/transport/calculate/cutoffSchedule.d.ts +35 -35
- package/dist/transport/calculate/cutoffSchedule.js +95 -70
- package/dist/transport/calculate/dwellTime.d.ts +18 -18
- package/dist/transport/calculate/dwellTime.js +111 -128
- package/dist/transport/calculate/estimateDrift.d.ts +25 -24
- package/dist/transport/calculate/estimateDrift.js +67 -73
- package/dist/transport/calculate/index.d.ts +11 -10
- package/dist/transport/calculate/index.js +12 -10
- package/dist/transport/calculate/nextDeparture.d.ts +18 -18
- package/dist/transport/calculate/nextDeparture.js +97 -119
- package/dist/transport/calculate/punctualityRate.d.ts +13 -12
- package/dist/transport/calculate/punctualityRate.js +52 -57
- package/dist/transport/calculate/scheduleDelivery.d.ts +70 -70
- package/dist/transport/calculate/scheduleDelivery.js +237 -275
- package/dist/transport/calculate/transitTime.d.ts +12 -12
- package/dist/transport/calculate/transitTime.js +87 -96
- package/dist/transport/compare/classifyPunctuality.d.ts +4 -3
- package/dist/transport/compare/classifyPunctuality.js +60 -62
- package/dist/transport/compare/index.d.ts +5 -4
- package/dist/transport/compare/index.js +6 -4
- package/dist/transport/compare/isPastCutoff.d.ts +2 -2
- package/dist/transport/compare/isPastCutoff.js +44 -45
- package/dist/transport/compare/scheduleDeviation.d.ts +2 -2
- package/dist/transport/compare/scheduleDeviation.js +47 -50
- package/dist/transport/compare/timeToCutoff.d.ts +2 -2
- package/dist/transport/compare/timeToCutoff.js +41 -44
- package/dist/transport/convert/etaAtZone.d.ts +4 -4
- package/dist/transport/convert/etaAtZone.js +59 -60
- package/dist/transport/convert/index.d.ts +2 -1
- package/dist/transport/convert/index.js +3 -1
- package/dist/transport/index.d.ts +19 -4
- package/dist/transport/index.js +18 -5
- package/dist/types/business-calendar.d.ts +21 -21
- package/dist/types/calendar-options.d.ts +17 -17
- package/dist/types/calendar-system.d.ts +1 -1
- package/dist/types/cron.d.ts +45 -0
- package/dist/types/cron.js +0 -0
- package/dist/types/date-cycle-field.d.ts +1 -1
- package/dist/types/date-duration-unit.d.ts +2 -2
- package/dist/types/date-time-cycle-field.d.ts +3 -3
- package/dist/types/date-time-duration-units.d.ts +2 -2
- package/dist/types/date-time-unit.d.ts +2 -2
- package/dist/types/date-unit.d.ts +2 -2
- package/dist/types/datetime-format-options.d.ts +1 -1
- package/dist/types/disambiguation.d.ts +2 -2
- package/dist/types/duration-relative-to.d.ts +5 -2
- package/dist/types/duration-string-options.d.ts +25 -25
- package/dist/types/duty.d.ts +522 -522
- package/dist/types/edi.d.ts +75 -75
- package/dist/types/epcis.d.ts +15 -15
- package/dist/types/exact-duration-unit.d.ts +2 -2
- package/dist/types/fiscal-calendar.d.ts +47 -11
- package/dist/types/fractional-digit.d.ts +1 -1
- package/dist/types/free-time-options.d.ts +28 -28
- package/dist/types/gnss.d.ts +51 -0
- package/dist/types/gnss.js +0 -0
- package/dist/types/holiday-rule.d.ts +123 -0
- package/dist/types/holiday-rule.js +0 -0
- package/dist/types/index.d.ts +49 -42
- package/dist/types/index.js +0 -41
- package/dist/types/interval.d.ts +8 -8
- package/dist/types/now-unit.d.ts +3 -1
- package/dist/types/observance-policy.d.ts +19 -0
- package/dist/types/observance-policy.js +0 -0
- package/dist/types/offset.d.ts +2 -2
- package/dist/types/operating-schedule.d.ts +47 -47
- package/dist/types/overflow.d.ts +2 -2
- package/dist/types/recurrence.d.ts +131 -0
- package/dist/types/recurrence.js +0 -0
- package/dist/types/relative-date-time-unit.d.ts +1 -1
- package/dist/types/relative-date-unit.d.ts +1 -1
- package/dist/types/relative-rounding-method.d.ts +1 -1
- package/dist/types/relative-time-options.d.ts +40 -40
- package/dist/types/relative-time-unit.d.ts +1 -1
- package/dist/types/relative-unit.d.ts +1 -1
- package/dist/types/roll-convention.d.ts +1 -1
- package/dist/types/rounding-options.d.ts +27 -27
- package/dist/types/stored-zoned-classification.d.ts +83 -0
- package/dist/types/stored-zoned-classification.js +0 -0
- package/dist/types/time-cycle-field.d.ts +1 -1
- package/dist/types/time-duration-unit.d.ts +2 -2
- package/dist/types/time-unit.d.ts +2 -2
- package/dist/types/transport-timestamps.d.ts +25 -25
- package/dist/types/two-digit-year.d.ts +15 -15
- package/dist/types/unix-now-unit.d.ts +2 -1
- package/dist/types/utc-now-unit.d.ts +3 -1
- package/dist/types/zone-bucket-unit.d.ts +1 -1
- package/dist/unix/calculate/addUnix.d.ts +28 -26
- package/dist/unix/calculate/addUnix.js +56 -60
- package/dist/unix/calculate/diffUnix.d.ts +22 -20
- package/dist/unix/calculate/diffUnix.js +96 -109
- package/dist/unix/calculate/diffUnixAsDuration.d.ts +23 -20
- package/dist/unix/calculate/diffUnixAsDuration.js +69 -75
- package/dist/unix/calculate/endOfQuarterForUnix.d.ts +18 -18
- package/dist/unix/calculate/endOfQuarterForUnix.js +37 -38
- package/dist/unix/calculate/endOfUnix.d.ts +28 -28
- package/dist/unix/calculate/endOfUnix.js +46 -48
- package/dist/unix/calculate/index.d.ts +16 -14
- package/dist/unix/calculate/index.js +17 -14
- package/dist/unix/calculate/isBetweenUnix.d.ts +32 -32
- package/dist/unix/calculate/isBetweenUnix.js +44 -59
- package/dist/unix/calculate/maxUnix.d.ts +1 -1
- package/dist/unix/calculate/maxUnix.js +26 -27
- package/dist/unix/calculate/minUnix.d.ts +1 -1
- package/dist/unix/calculate/minUnix.js +26 -27
- package/dist/unix/calculate/roundUnix.d.ts +46 -44
- package/dist/unix/calculate/roundUnix.js +79 -85
- package/dist/unix/calculate/secondsUntilUnix.d.ts +55 -0
- package/dist/unix/calculate/secondsUntilUnix.js +62 -0
- package/dist/unix/calculate/setUnix.d.ts +49 -46
- package/dist/unix/calculate/setUnix.js +80 -87
- package/dist/unix/calculate/sortUnix.d.ts +1 -1
- package/dist/unix/calculate/sortUnix.js +31 -33
- package/dist/unix/calculate/startOfQuarterForUnix.d.ts +18 -18
- package/dist/unix/calculate/startOfQuarterForUnix.js +38 -39
- package/dist/unix/calculate/startOfUnix.d.ts +28 -28
- package/dist/unix/calculate/startOfUnix.js +46 -48
- package/dist/unix/calculate/subtractUnix.d.ts +28 -26
- package/dist/unix/calculate/subtractUnix.js +55 -59
- package/dist/unix/compare/areUnixEqual.d.ts +9 -9
- package/dist/unix/compare/areUnixEqual.js +33 -34
- package/dist/unix/compare/areUnixEqualBy.d.ts +32 -32
- package/dist/unix/compare/areUnixEqualBy.js +54 -54
- package/dist/unix/compare/index.d.ts +5 -4
- package/dist/unix/compare/index.js +6 -4
- package/dist/unix/compare/isAfterUnix.d.ts +9 -9
- package/dist/unix/compare/isAfterUnix.js +31 -32
- package/dist/unix/compare/isBeforeUnix.d.ts +9 -9
- package/dist/unix/compare/isBeforeUnix.js +32 -33
- package/dist/unix/convert/convertUnixToPlainDate.d.ts +22 -22
- package/dist/unix/convert/convertUnixToPlainDate.js +42 -47
- package/dist/unix/convert/convertUnixToPlainDateTime.d.ts +22 -22
- package/dist/unix/convert/convertUnixToPlainDateTime.js +40 -45
- package/dist/unix/convert/convertUnixToPlainTime.d.ts +23 -23
- package/dist/unix/convert/convertUnixToPlainTime.js +40 -45
- package/dist/unix/convert/convertUnixToUtc.d.ts +9 -9
- package/dist/unix/convert/convertUnixToUtc.js +32 -33
- package/dist/unix/convert/convertUnixToZoned.d.ts +10 -10
- package/dist/unix/convert/convertUnixToZoned.js +43 -47
- package/dist/unix/convert/index.d.ts +6 -5
- package/dist/unix/convert/index.js +7 -5
- package/dist/unix/format/formatCalendarUnix.d.ts +40 -39
- package/dist/unix/format/formatCalendarUnix.js +53 -60
- package/dist/unix/format/formatRelativeUnix.d.ts +67 -65
- package/dist/unix/format/formatRelativeUnix.js +64 -73
- package/dist/unix/format/formatUnix.d.ts +33 -33
- package/dist/unix/format/formatUnix.js +68 -75
- package/dist/unix/format/index.d.ts +4 -3
- package/dist/unix/format/index.js +5 -3
- package/dist/unix/get/getUnixAgo.d.ts +38 -0
- package/dist/unix/get/getUnixAgo.js +44 -0
- package/dist/unix/get/getUnixDay.d.ts +2 -2
- package/dist/unix/get/getUnixDay.js +16 -15
- package/dist/unix/get/getUnixHour.d.ts +2 -2
- package/dist/unix/get/getUnixHour.js +16 -15
- package/dist/unix/get/getUnixIn.d.ts +40 -0
- package/dist/unix/get/getUnixIn.js +46 -0
- package/dist/unix/get/getUnixMicrosecond.d.ts +2 -2
- package/dist/unix/get/getUnixMicrosecond.js +16 -14
- package/dist/unix/get/getUnixMillisecond.d.ts +2 -2
- package/dist/unix/get/getUnixMillisecond.js +16 -15
- package/dist/unix/get/getUnixMinute.d.ts +2 -2
- package/dist/unix/get/getUnixMinute.js +16 -15
- package/dist/unix/get/getUnixMonth.d.ts +2 -2
- package/dist/unix/get/getUnixMonth.js +16 -15
- package/dist/unix/get/getUnixNanosecond.d.ts +2 -2
- package/dist/unix/get/getUnixNanosecond.js +16 -14
- package/dist/unix/get/getUnixNow.d.ts +19 -16
- package/dist/unix/get/getUnixNow.js +14 -35
- package/dist/unix/get/getUnixNowUnit.d.ts +5 -4
- package/dist/unix/get/getUnixNowUnit.js +34 -32
- package/dist/unix/get/getUnixSecond.d.ts +2 -2
- package/dist/unix/get/getUnixSecond.js +16 -15
- package/dist/unix/get/getUnixYear.d.ts +2 -2
- package/dist/unix/get/getUnixYear.js +18 -14
- package/dist/unix/get/index.d.ts +15 -11
- package/dist/unix/get/index.js +15 -11
- package/dist/unix/index.d.ts +85 -9
- package/dist/unix/index.js +79 -10
- package/dist/unix/interval/index.d.ts +19 -18
- package/dist/unix/interval/index.js +20 -18
- package/dist/unix/interval/intervalAbutsUnix.d.ts +1 -1
- package/dist/unix/interval/intervalAbutsUnix.js +36 -34
- package/dist/unix/interval/intervalContainsUnix.d.ts +1 -1
- package/dist/unix/interval/intervalContainsUnix.js +48 -45
- package/dist/unix/interval/intervalCountUnix.d.ts +18 -18
- package/dist/unix/interval/intervalCountUnix.js +64 -71
- package/dist/unix/interval/intervalDifferenceUnix.d.ts +9 -9
- package/dist/unix/interval/intervalDifferenceUnix.js +38 -37
- package/dist/unix/interval/intervalDivideEquallyUnix.d.ts +17 -17
- package/dist/unix/interval/intervalDivideEquallyUnix.js +65 -72
- package/dist/unix/interval/intervalEngulfsUnix.d.ts +1 -1
- package/dist/unix/interval/intervalEngulfsUnix.js +35 -32
- package/dist/unix/interval/intervalFromDurationUnix.d.ts +38 -37
- package/dist/unix/interval/intervalFromDurationUnix.js +75 -88
- package/dist/unix/interval/intervalIntersectionUnix.d.ts +9 -9
- package/dist/unix/interval/intervalIntersectionUnix.js +35 -34
- package/dist/unix/interval/intervalLengthUnix.d.ts +20 -20
- package/dist/unix/interval/intervalLengthUnix.js +55 -63
- package/dist/unix/interval/intervalOverlappingDaysUnix.d.ts +18 -18
- package/dist/unix/interval/intervalOverlappingDaysUnix.js +85 -93
- package/dist/unix/interval/intervalSplitAtUnix.d.ts +9 -9
- package/dist/unix/interval/intervalSplitAtUnix.js +61 -62
- package/dist/unix/interval/intervalUnionUnix.d.ts +9 -9
- package/dist/unix/interval/intervalUnionUnix.js +36 -34
- package/dist/unix/interval/intervalXorAllUnix.d.ts +11 -11
- package/dist/unix/interval/intervalXorAllUnix.js +37 -40
- package/dist/unix/interval/intervalXorUnix.d.ts +9 -9
- package/dist/unix/interval/intervalXorUnix.js +41 -40
- package/dist/unix/interval/intervalsOverlapUnix.d.ts +1 -1
- package/dist/unix/interval/intervalsOverlapUnix.js +35 -33
- package/dist/unix/interval/mergeIntervalsUnix.d.ts +11 -11
- package/dist/unix/interval/mergeIntervalsUnix.js +38 -42
- package/dist/unix/interval/splitIntervalByUnitUnix.d.ts +40 -39
- package/dist/unix/interval/splitIntervalByUnitUnix.js +92 -108
- package/dist/unix/interval/validate/index.d.ts +2 -1
- package/dist/unix/interval/validate/index.js +3 -1
- package/dist/unix/interval/validate/isValidUnixInterval.d.ts +1 -1
- package/dist/unix/interval/validate/isValidUnixInterval.js +32 -30
- package/dist/unix/parse/index.d.ts +15 -14
- package/dist/unix/parse/index.js +16 -14
- package/dist/unix/parse/parseDateFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseDateFromUnix.js +28 -29
- package/dist/unix/parse/parseDayFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseDayFromUnix.js +26 -27
- package/dist/unix/parse/parseDayOfWeekFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseDayOfWeekFromUnix.js +27 -28
- package/dist/unix/parse/parseHourFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseHourFromUnix.js +26 -27
- package/dist/unix/parse/parseMicrosecondFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseMicrosecondFromUnix.js +26 -27
- package/dist/unix/parse/parseMillisecondFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseMillisecondFromUnix.js +26 -27
- package/dist/unix/parse/parseMinuteFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseMinuteFromUnix.js +26 -27
- package/dist/unix/parse/parseMonthFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseMonthFromUnix.js +27 -28
- package/dist/unix/parse/parseNanosecondFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseNanosecondFromUnix.js +27 -28
- package/dist/unix/parse/parseSecondFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseSecondFromUnix.js +26 -27
- package/dist/unix/parse/parseTimeFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseTimeFromUnix.js +29 -30
- package/dist/unix/parse/parseUnitFromUnix.d.ts +28 -28
- package/dist/unix/parse/parseUnitFromUnix.js +60 -80
- package/dist/unix/parse/parseWeekFromUnix.d.ts +26 -26
- package/dist/unix/parse/parseWeekFromUnix.js +37 -41
- package/dist/unix/parse/parseYearFromUnix.d.ts +18 -18
- package/dist/unix/parse/parseYearFromUnix.js +30 -31
- package/dist/unix/validate/index.d.ts +5 -4
- package/dist/unix/validate/index.js +6 -4
- package/dist/unix/validate/isValidUnixMilliseconds.d.ts +1 -1
- package/dist/unix/validate/isValidUnixMilliseconds.js +21 -17
- package/dist/unix/validate/isValidUnixRange.d.ts +22 -22
- package/dist/unix/validate/isValidUnixRange.js +37 -39
- package/dist/unix/validate/isValidUnixSeconds.d.ts +1 -1
- package/dist/unix/validate/isValidUnixSeconds.js +21 -17
- package/dist/unix/validate/isValidUnixUnit.d.ts +1 -1
- package/dist/unix/validate/isValidUnixUnit.js +21 -17
- package/dist/utc/calculate/addUtc.d.ts +11 -9
- package/dist/utc/calculate/addUtc.js +38 -47
- package/dist/utc/calculate/diffUtc.d.ts +5 -3
- package/dist/utc/calculate/diffUtc.js +81 -100
- package/dist/utc/calculate/diffUtcAsDuration.d.ts +6 -3
- package/dist/utc/calculate/diffUtcAsDuration.js +51 -53
- package/dist/utc/calculate/endOfQuarterForUtc.d.ts +1 -1
- package/dist/utc/calculate/endOfQuarterForUtc.js +40 -46
- package/dist/utc/calculate/endOfUtc.d.ts +20 -19
- package/dist/utc/calculate/endOfUtc.js +33 -34
- package/dist/utc/calculate/index.d.ts +17 -14
- package/dist/utc/calculate/index.js +18 -14
- package/dist/utc/calculate/isBetweenUtc.d.ts +15 -15
- package/dist/utc/calculate/isBetweenUtc.js +48 -64
- package/dist/utc/calculate/maxUtc.d.ts +1 -1
- package/dist/utc/calculate/maxUtc.js +34 -39
- package/dist/utc/calculate/minUtc.d.ts +1 -1
- package/dist/utc/calculate/minUtc.js +34 -39
- package/dist/utc/calculate/roundUtc.d.ts +33 -32
- package/dist/utc/calculate/roundUtc.js +52 -55
- package/dist/utc/calculate/secondsUntilHttpDate.d.ts +34 -0
- package/dist/utc/calculate/secondsUntilHttpDate.js +50 -0
- package/dist/utc/calculate/secondsUntilRetryAfter.d.ts +29 -0
- package/dist/utc/calculate/secondsUntilRetryAfter.js +51 -0
- package/dist/utc/calculate/setUtc.d.ts +11 -10
- package/dist/utc/calculate/setUtc.js +62 -69
- package/dist/utc/calculate/sortUtc.d.ts +1 -1
- package/dist/utc/calculate/sortUtc.js +36 -40
- package/dist/utc/calculate/startOfQuarterForUtc.d.ts +1 -1
- package/dist/utc/calculate/startOfQuarterForUtc.js +38 -41
- package/dist/utc/calculate/startOfUtc.d.ts +20 -19
- package/dist/utc/calculate/startOfUtc.js +28 -29
- package/dist/utc/calculate/subtractUtc.d.ts +11 -9
- package/dist/utc/calculate/subtractUtc.js +38 -47
- package/dist/utc/chop/chopUtc.d.ts +1 -1
- package/dist/utc/chop/chopUtc.js +23 -22
- package/dist/utc/chop/index.d.ts +2 -1
- package/dist/utc/chop/index.js +3 -1
- package/dist/utc/compare/areUtcEqual.d.ts +1 -1
- package/dist/utc/compare/areUtcEqual.js +28 -27
- package/dist/utc/compare/areUtcEqualBy.d.ts +11 -11
- package/dist/utc/compare/areUtcEqualBy.js +54 -62
- package/dist/utc/compare/index.d.ts +5 -4
- package/dist/utc/compare/index.js +6 -4
- package/dist/utc/compare/isAfterUtc.d.ts +1 -1
- package/dist/utc/compare/isAfterUtc.js +28 -26
- package/dist/utc/compare/isBeforeUtc.d.ts +1 -1
- package/dist/utc/compare/isBeforeUtc.js +28 -27
- package/dist/utc/convert/convertUtcToPlainDate.d.ts +11 -11
- package/dist/utc/convert/convertUtcToPlainDate.js +39 -46
- package/dist/utc/convert/convertUtcToPlainDateTime.d.ts +11 -11
- package/dist/utc/convert/convertUtcToPlainDateTime.js +40 -48
- package/dist/utc/convert/convertUtcToPlainTime.d.ts +11 -11
- package/dist/utc/convert/convertUtcToPlainTime.js +37 -44
- package/dist/utc/convert/convertUtcToUnix.d.ts +9 -9
- package/dist/utc/convert/convertUtcToUnix.js +37 -39
- package/dist/utc/convert/convertUtcToZoned.d.ts +2 -2
- package/dist/utc/convert/convertUtcToZoned.js +31 -30
- package/dist/utc/convert/index.d.ts +6 -5
- package/dist/utc/convert/index.js +7 -5
- package/dist/utc/format/formatCalendarUtc.d.ts +23 -21
- package/dist/utc/format/formatCalendarUtc.js +51 -62
- package/dist/utc/format/formatHttpDate.d.ts +1 -1
- package/dist/utc/format/formatHttpDate.js +41 -42
- package/dist/utc/format/formatHttpDateFromNow.d.ts +31 -0
- package/dist/utc/format/formatHttpDateFromNow.js +45 -0
- package/dist/utc/format/formatRelativeUtc.d.ts +33 -31
- package/dist/utc/format/formatRelativeUtc.js +60 -71
- package/dist/utc/format/formatUtc.d.ts +25 -25
- package/dist/utc/format/formatUtc.js +60 -68
- package/dist/utc/format/index.d.ts +6 -4
- package/dist/utc/format/index.js +7 -4
- package/dist/utc/get/getUtcAgo.d.ts +31 -0
- package/dist/utc/get/getUtcAgo.js +47 -0
- package/dist/utc/get/getUtcDay.d.ts +2 -2
- package/dist/utc/get/getUtcDay.js +16 -15
- package/dist/utc/get/getUtcHour.d.ts +2 -2
- package/dist/utc/get/getUtcHour.js +16 -15
- package/dist/utc/get/getUtcIn.d.ts +31 -0
- package/dist/utc/get/getUtcIn.js +47 -0
- package/dist/utc/get/getUtcMicrosecond.d.ts +2 -2
- package/dist/utc/get/getUtcMicrosecond.js +16 -14
- package/dist/utc/get/getUtcMillisecond.d.ts +2 -2
- package/dist/utc/get/getUtcMillisecond.js +16 -15
- package/dist/utc/get/getUtcMinute.d.ts +2 -2
- package/dist/utc/get/getUtcMinute.js +16 -15
- package/dist/utc/get/getUtcMonth.d.ts +2 -2
- package/dist/utc/get/getUtcMonth.js +16 -15
- package/dist/utc/get/getUtcNanosecond.d.ts +2 -2
- package/dist/utc/get/getUtcNanosecond.js +16 -14
- package/dist/utc/get/getUtcNow.d.ts +2 -2
- package/dist/utc/get/getUtcNow.js +15 -11
- package/dist/utc/get/getUtcNowUnit.d.ts +4 -3
- package/dist/utc/get/getUtcNowUnit.js +36 -36
- package/dist/utc/get/getUtcSecond.d.ts +2 -2
- package/dist/utc/get/getUtcSecond.js +16 -15
- package/dist/utc/get/getUtcYear.d.ts +2 -2
- package/dist/utc/get/getUtcYear.js +18 -14
- package/dist/utc/get/index.d.ts +15 -11
- package/dist/utc/get/index.js +15 -11
- package/dist/utc/index.d.ts +90 -10
- package/dist/utc/index.js +84 -11
- package/dist/utc/interval/index.d.ts +19 -18
- package/dist/utc/interval/index.js +20 -18
- package/dist/utc/interval/intervalAbutsUtc.d.ts +1 -1
- package/dist/utc/interval/intervalAbutsUtc.js +50 -56
- package/dist/utc/interval/intervalContainsUtc.d.ts +1 -1
- package/dist/utc/interval/intervalContainsUtc.js +60 -63
- package/dist/utc/interval/intervalCountUtc.d.ts +1 -1
- package/dist/utc/interval/intervalCountUtc.js +49 -59
- package/dist/utc/interval/intervalDifferenceUtc.d.ts +9 -9
- package/dist/utc/interval/intervalDifferenceUtc.js +44 -48
- package/dist/utc/interval/intervalDivideEquallyUtc.d.ts +17 -17
- package/dist/utc/interval/intervalDivideEquallyUtc.js +69 -82
- package/dist/utc/interval/intervalEngulfsUtc.d.ts +1 -1
- package/dist/utc/interval/intervalEngulfsUtc.js +52 -58
- package/dist/utc/interval/intervalFromDurationUtc.d.ts +18 -17
- package/dist/utc/interval/intervalFromDurationUtc.js +53 -64
- package/dist/utc/interval/intervalIntersectionUtc.d.ts +9 -9
- package/dist/utc/interval/intervalIntersectionUtc.js +42 -45
- package/dist/utc/interval/intervalLengthUtc.d.ts +1 -1
- package/dist/utc/interval/intervalLengthUtc.js +42 -48
- package/dist/utc/interval/intervalOverlappingDaysUtc.d.ts +1 -1
- package/dist/utc/interval/intervalOverlappingDaysUtc.js +53 -62
- package/dist/utc/interval/intervalSplitAtUtc.d.ts +9 -9
- package/dist/utc/interval/intervalSplitAtUtc.js +63 -70
- package/dist/utc/interval/intervalUnionUtc.d.ts +9 -9
- package/dist/utc/interval/intervalUnionUtc.js +45 -52
- package/dist/utc/interval/intervalXorAllUtc.d.ts +11 -11
- package/dist/utc/interval/intervalXorAllUtc.js +49 -56
- package/dist/utc/interval/intervalXorUtc.d.ts +9 -9
- package/dist/utc/interval/intervalXorUtc.js +52 -61
- package/dist/utc/interval/intervalsOverlapUtc.d.ts +1 -1
- package/dist/utc/interval/intervalsOverlapUtc.js +40 -41
- package/dist/utc/interval/mergeIntervalsUtc.d.ts +11 -11
- package/dist/utc/interval/mergeIntervalsUtc.js +39 -45
- package/dist/utc/interval/splitIntervalByUnitUtc.d.ts +19 -18
- package/dist/utc/interval/splitIntervalByUnitUtc.js +79 -96
- package/dist/utc/interval/validate/index.d.ts +2 -1
- package/dist/utc/interval/validate/index.js +3 -1
- package/dist/utc/interval/validate/isValidUtcInterval.d.ts +1 -1
- package/dist/utc/interval/validate/isValidUtcInterval.js +38 -39
- package/dist/utc/parse/index.d.ts +16 -15
- package/dist/utc/parse/index.js +17 -15
- package/dist/utc/parse/parseDateFromUtc.d.ts +11 -11
- package/dist/utc/parse/parseDateFromUtc.js +26 -27
- package/dist/utc/parse/parseDayFromUtc.d.ts +11 -11
- package/dist/utc/parse/parseDayFromUtc.js +26 -27
- package/dist/utc/parse/parseDayOfWeekFromUtc.d.ts +11 -11
- package/dist/utc/parse/parseDayOfWeekFromUtc.js +35 -40
- package/dist/utc/parse/parseHourFromUtc.d.ts +11 -11
- package/dist/utc/parse/parseHourFromUtc.js +26 -27
- package/dist/utc/parse/parseHttpDate.d.ts +4 -2
- package/dist/utc/parse/parseHttpDate.js +87 -88
- package/dist/utc/parse/parseMicrosecondFromUtc.d.ts +11 -11
- package/dist/utc/parse/parseMicrosecondFromUtc.js +27 -30
- package/dist/utc/parse/parseMillisecondFromUtc.d.ts +11 -11
- package/dist/utc/parse/parseMillisecondFromUtc.js +26 -29
- package/dist/utc/parse/parseMinuteFromUtc.d.ts +10 -10
- package/dist/utc/parse/parseMinuteFromUtc.js +26 -27
- package/dist/utc/parse/parseMonthFromUtc.d.ts +11 -11
- package/dist/utc/parse/parseMonthFromUtc.js +26 -27
- package/dist/utc/parse/parseNanosecondFromUtc.d.ts +11 -11
- package/dist/utc/parse/parseNanosecondFromUtc.js +27 -30
- package/dist/utc/parse/parseSecondFromUtc.d.ts +11 -11
- package/dist/utc/parse/parseSecondFromUtc.js +26 -27
- package/dist/utc/parse/parseTimeFromUtc.d.ts +11 -11
- package/dist/utc/parse/parseTimeFromUtc.js +36 -43
- package/dist/utc/parse/parseUnitFromUtc.d.ts +21 -21
- package/dist/utc/parse/parseUnitFromUtc.js +63 -81
- package/dist/utc/parse/parseWeekFromUtc.d.ts +20 -20
- package/dist/utc/parse/parseWeekFromUtc.js +42 -47
- package/dist/utc/parse/parseYearFromUtc.d.ts +11 -11
- package/dist/utc/parse/parseYearFromUtc.js +28 -29
- package/dist/utc/validate/index.d.ts +5 -4
- package/dist/utc/validate/index.js +6 -4
- package/dist/utc/validate/isValidHttpDate.d.ts +8 -3
- package/dist/utc/validate/isValidHttpDate.js +6 -36
- package/dist/utc/validate/isValidUtc.d.ts +6 -1
- package/dist/utc/validate/isValidUtc.js +17 -44
- package/dist/utc/validate/isValidUtcRange.d.ts +17 -17
- package/dist/utc/validate/isValidUtcRange.js +40 -49
- package/dist/utc/validate/isValidUtcTimestamp.d.ts +6 -2
- package/dist/utc/validate/isValidUtcTimestamp.js +6 -45
- package/dist/{duty → workforce}/calculate/dutyDayFor.d.ts +4 -2
- package/dist/workforce/calculate/dutyDayFor.js +65 -0
- package/dist/{duty → workforce}/calculate/dutyTotals.d.ts +4 -2
- package/dist/workforce/calculate/dutyTotals.js +41 -0
- package/dist/{duty → workforce}/calculate/dutyViolations.d.ts +28 -25
- package/dist/workforce/calculate/dutyViolations.js +64 -0
- package/dist/{duty → workforce}/calculate/evaluateDutyLog.d.ts +27 -25
- package/dist/workforce/calculate/evaluateDutyLog.js +74 -0
- package/dist/workforce/calculate/index.d.ts +8 -0
- package/dist/workforce/calculate/index.js +9 -0
- package/dist/{duty → workforce}/calculate/longestRun.d.ts +8 -6
- package/dist/workforce/calculate/longestRun.js +49 -0
- package/dist/{duty → workforce}/calculate/qualifyingRestPairs.d.ts +12 -11
- package/dist/workforce/calculate/qualifyingRestPairs.js +59 -0
- package/dist/{duty → workforce}/calculate/qualifyingRests.d.ts +8 -6
- package/dist/workforce/calculate/qualifyingRests.js +45 -0
- package/dist/workforce/index.d.ts +11 -0
- package/dist/workforce/index.js +11 -0
- package/dist/workforce/validate/index.d.ts +2 -0
- package/dist/workforce/validate/index.js +3 -0
- package/dist/{duty → workforce}/validate/isValidDutyLog.d.ts +3 -3
- package/dist/workforce/validate/isValidDutyLog.js +35 -0
- package/dist/zoned/calculate/addZoned.d.ts +38 -35
- package/dist/zoned/calculate/addZoned.js +85 -89
- package/dist/zoned/calculate/addZonedBusinessDays.d.ts +6 -5
- package/dist/zoned/calculate/addZonedBusinessDays.js +29 -30
- package/dist/zoned/calculate/clampZoned.d.ts +1 -1
- package/dist/zoned/calculate/clampZoned.js +40 -47
- package/dist/zoned/calculate/closestZonedTo.d.ts +1 -1
- package/dist/zoned/calculate/closestZonedTo.js +43 -53
- package/dist/zoned/calculate/cycleZoned.d.ts +42 -38
- package/dist/zoned/calculate/cycleZoned.js +56 -56
- package/dist/zoned/calculate/diffZoned.d.ts +12 -10
- package/dist/zoned/calculate/diffZoned.js +98 -117
- package/dist/zoned/calculate/diffZonedAsDuration.d.ts +10 -7
- package/dist/zoned/calculate/diffZonedAsDuration.js +65 -69
- package/dist/zoned/calculate/endOfQuarterForZoned.d.ts +11 -10
- package/dist/zoned/calculate/endOfQuarterForZoned.js +41 -46
- package/dist/zoned/calculate/endOfZoned.d.ts +23 -21
- package/dist/zoned/calculate/endOfZoned.js +39 -40
- package/dist/zoned/calculate/getHoursInZonedDay.d.ts +3 -3
- package/dist/zoned/calculate/getHoursInZonedDay.js +41 -39
- package/dist/zoned/calculate/getLocaleZonedDayOfWeek.d.ts +7 -6
- package/dist/zoned/calculate/getLocaleZonedDayOfWeek.js +39 -37
- package/dist/zoned/calculate/getLocaleZonedEndOfWeek.d.ts +16 -15
- package/dist/zoned/calculate/getLocaleZonedEndOfWeek.js +57 -59
- package/dist/zoned/calculate/getLocaleZonedStartOfWeek.d.ts +16 -15
- package/dist/zoned/calculate/getLocaleZonedStartOfWeek.js +55 -57
- package/dist/zoned/calculate/getQuarterForZoned.d.ts +1 -1
- package/dist/zoned/calculate/getQuarterForZoned.js +27 -26
- package/dist/zoned/calculate/index.d.ts +24 -23
- package/dist/zoned/calculate/index.js +25 -23
- package/dist/zoned/calculate/maxZoned.d.ts +3 -3
- package/dist/zoned/calculate/maxZoned.js +36 -41
- package/dist/zoned/calculate/minZoned.d.ts +3 -3
- package/dist/zoned/calculate/minZoned.js +36 -41
- package/dist/zoned/calculate/roundZoned.d.ts +35 -33
- package/dist/zoned/calculate/roundZoned.js +69 -70
- package/dist/zoned/calculate/setZoned.d.ts +40 -37
- package/dist/zoned/calculate/setZoned.js +76 -82
- package/dist/zoned/calculate/sortZoned.d.ts +4 -4
- package/dist/zoned/calculate/sortZoned.js +38 -42
- package/dist/zoned/calculate/startOfQuarterForZoned.d.ts +10 -9
- package/dist/zoned/calculate/startOfQuarterForZoned.js +37 -40
- package/dist/zoned/calculate/startOfZoned.d.ts +23 -21
- package/dist/zoned/calculate/startOfZoned.js +34 -35
- package/dist/zoned/calculate/subtractZoned.d.ts +37 -34
- package/dist/zoned/calculate/subtractZoned.js +81 -84
- package/dist/zoned/calculate/subtractZonedBusinessDays.d.ts +6 -5
- package/dist/zoned/calculate/subtractZonedBusinessDays.js +29 -28
- package/dist/zoned/chop/chopZonedDate.d.ts +2 -2
- package/dist/zoned/chop/chopZonedDate.js +23 -21
- package/dist/zoned/chop/chopZonedDateTime.d.ts +1 -1
- package/dist/zoned/chop/chopZonedDateTime.js +23 -23
- package/dist/zoned/chop/chopZonedMilliseconds.d.ts +2 -2
- package/dist/zoned/chop/chopZonedMilliseconds.js +23 -23
- package/dist/zoned/chop/chopZonedSeconds.d.ts +2 -2
- package/dist/zoned/chop/chopZonedSeconds.js +23 -23
- package/dist/zoned/chop/chopZonedTime.d.ts +2 -2
- package/dist/zoned/chop/chopZonedTime.js +23 -21
- package/dist/zoned/chop/chopZonedTimezone.d.ts +2 -2
- package/dist/zoned/chop/chopZonedTimezone.js +23 -21
- package/dist/zoned/chop/index.d.ts +7 -6
- package/dist/zoned/chop/index.js +8 -6
- package/dist/zoned/classify/classifyStoredZoned.d.ts +47 -0
- package/dist/zoned/classify/classifyStoredZoned.js +158 -0
- package/dist/zoned/classify/index.d.ts +2 -0
- package/dist/zoned/classify/index.js +3 -0
- package/dist/zoned/compare/areZonedEqual.d.ts +20 -4
- package/dist/zoned/compare/areZonedEqual.js +51 -44
- package/dist/zoned/compare/areZonedEqualBy.d.ts +21 -21
- package/dist/zoned/compare/areZonedEqualBy.js +69 -80
- package/dist/zoned/compare/index.d.ts +13 -12
- package/dist/zoned/compare/index.js +14 -12
- package/dist/zoned/compare/isAfterZoned.d.ts +1 -1
- package/dist/zoned/compare/isAfterZoned.js +35 -35
- package/dist/zoned/compare/isBeforeZoned.d.ts +3 -3
- package/dist/zoned/compare/isBeforeZoned.js +35 -35
- package/dist/zoned/compare/isBetweenZoned.d.ts +15 -15
- package/dist/zoned/compare/isBetweenZoned.js +51 -69
- package/dist/zoned/compare/isInDaylightSaving.d.ts +3 -3
- package/dist/zoned/compare/isInDaylightSaving.js +64 -62
- package/dist/zoned/compare/isZonedBusinessDay.d.ts +8 -7
- package/dist/zoned/compare/isZonedBusinessDay.js +38 -35
- package/dist/zoned/compare/isZonedFuture.d.ts +2 -2
- package/dist/zoned/compare/isZonedFuture.js +32 -30
- package/dist/zoned/compare/isZonedPast.d.ts +2 -2
- package/dist/zoned/compare/isZonedPast.js +32 -30
- package/dist/zoned/compare/isZonedRelativeDay.d.ts +3 -3
- package/dist/zoned/compare/isZonedRelativeDay.js +40 -39
- package/dist/zoned/compare/isZonedThisUnit.d.ts +8 -8
- package/dist/zoned/compare/isZonedThisUnit.js +63 -69
- package/dist/zoned/compare/isZonedWeekend.d.ts +6 -6
- package/dist/zoned/compare/isZonedWeekend.js +42 -40
- package/dist/zoned/convert/convertPlainDateTimeToZoned.d.ts +26 -25
- package/dist/zoned/convert/convertPlainDateTimeToZoned.js +47 -54
- package/dist/zoned/convert/convertZonedToCalendar.d.ts +8 -7
- package/dist/zoned/convert/convertZonedToCalendar.js +50 -50
- package/dist/zoned/convert/convertZonedToPlainDateTime.d.ts +4 -4
- package/dist/zoned/convert/convertZonedToPlainDateTime.js +29 -28
- package/dist/zoned/convert/convertZonedToUnix.d.ts +10 -10
- package/dist/zoned/convert/convertZonedToUnix.js +35 -37
- package/dist/zoned/convert/convertZonedToUtc.d.ts +1 -1
- package/dist/zoned/convert/convertZonedToUtc.js +24 -23
- package/dist/zoned/convert/convertZonedToZoned.d.ts +3 -3
- package/dist/zoned/convert/convertZonedToZoned.js +30 -29
- package/dist/zoned/convert/index.d.ts +7 -6
- package/dist/zoned/convert/index.js +8 -6
- package/dist/zoned/format/formatCalendarZoned.d.ts +23 -22
- package/dist/zoned/format/formatCalendarZoned.js +50 -64
- package/dist/zoned/format/formatRelativeZoned.d.ts +48 -46
- package/dist/zoned/format/formatRelativeZoned.js +60 -76
- package/dist/zoned/format/formatRfc2822.d.ts +4 -4
- package/dist/zoned/format/formatRfc2822.js +55 -58
- package/dist/zoned/format/formatRfc3339.d.ts +3 -3
- package/dist/zoned/format/formatRfc3339.js +52 -60
- package/dist/zoned/format/formatTimeZoneName.d.ts +27 -27
- package/dist/zoned/format/formatTimeZoneName.js +61 -67
- package/dist/zoned/format/formatZonedDateTime.d.ts +13 -12
- package/dist/zoned/format/formatZonedDateTime.js +55 -61
- package/dist/zoned/format/formatZonedRange.d.ts +20 -11
- package/dist/zoned/format/formatZonedRange.js +101 -79
- package/dist/zoned/format/formatZonedToParts.d.ts +25 -24
- package/dist/zoned/format/formatZonedToParts.js +71 -77
- package/dist/zoned/format/index.d.ts +9 -8
- package/dist/zoned/format/index.js +10 -8
- package/dist/zoned/get/getDstTransitions.d.ts +13 -13
- package/dist/zoned/get/getDstTransitions.js +69 -73
- package/dist/zoned/get/getSystemTimeZone.d.ts +3 -3
- package/dist/zoned/get/getSystemTimeZone.js +22 -19
- package/dist/zoned/get/getTimeZoneOffset.d.ts +6 -6
- package/dist/zoned/get/getTimeZoneOffset.js +56 -62
- package/dist/zoned/get/getTimeZones.d.ts +2 -2
- package/dist/zoned/get/getTimeZones.js +19 -17
- package/dist/zoned/get/getZonedAgo.d.ts +33 -0
- package/dist/zoned/get/getZonedAgo.js +52 -0
- package/dist/zoned/get/getZonedDay.d.ts +3 -3
- package/dist/zoned/get/getZonedDay.js +24 -22
- package/dist/zoned/get/getZonedDayOfWeek.d.ts +3 -3
- package/dist/zoned/get/getZonedDayOfWeek.js +25 -24
- package/dist/zoned/get/getZonedHour.d.ts +3 -3
- package/dist/zoned/get/getZonedHour.js +24 -22
- package/dist/zoned/get/getZonedIn.d.ts +33 -0
- package/dist/zoned/get/getZonedIn.js +52 -0
- package/dist/zoned/get/getZonedMicrosecond.d.ts +3 -3
- package/dist/zoned/get/getZonedMicrosecond.js +24 -24
- package/dist/zoned/get/getZonedMillisecond.d.ts +3 -3
- package/dist/zoned/get/getZonedMillisecond.js +24 -22
- package/dist/zoned/get/getZonedMinute.d.ts +3 -3
- package/dist/zoned/get/getZonedMinute.js +24 -22
- package/dist/zoned/get/getZonedMonth.d.ts +3 -3
- package/dist/zoned/get/getZonedMonth.js +24 -22
- package/dist/zoned/get/getZonedNanosecond.d.ts +3 -3
- package/dist/zoned/get/getZonedNanosecond.js +24 -24
- package/dist/zoned/get/getZonedNow.d.ts +14 -14
- package/dist/zoned/get/getZonedNow.js +40 -51
- package/dist/zoned/get/getZonedNowUnit.d.ts +4 -4
- package/dist/zoned/get/getZonedNowUnit.js +52 -53
- package/dist/zoned/get/getZonedSecond.d.ts +3 -3
- package/dist/zoned/get/getZonedSecond.js +24 -22
- package/dist/zoned/get/getZonedToday.d.ts +3 -3
- package/dist/zoned/get/getZonedToday.js +24 -24
- package/dist/zoned/get/getZonedWeekOfYear.d.ts +3 -3
- package/dist/zoned/get/getZonedWeekOfYear.js +25 -24
- package/dist/zoned/get/getZonedYear.d.ts +3 -3
- package/dist/zoned/get/getZonedYear.js +27 -25
- package/dist/zoned/get/index.d.ts +21 -18
- package/dist/zoned/get/index.js +22 -18
- package/dist/zoned/index.d.ts +134 -11
- package/dist/zoned/index.js +127 -12
- package/dist/zoned/interval/index.d.ts +20 -18
- package/dist/zoned/interval/index.js +21 -18
- package/dist/zoned/interval/intervalAbutsZoned.d.ts +3 -3
- package/dist/zoned/interval/intervalAbutsZoned.js +66 -71
- package/dist/zoned/interval/intervalContainsZoned.d.ts +2 -2
- package/dist/zoned/interval/intervalContainsZoned.js +70 -76
- package/dist/zoned/interval/intervalCountZoned.d.ts +5 -5
- package/dist/zoned/interval/intervalCountZoned.js +69 -84
- package/dist/zoned/interval/intervalDifferenceZoned.d.ts +12 -12
- package/dist/zoned/interval/intervalDifferenceZoned.js +77 -80
- package/dist/zoned/interval/intervalDivideEquallyZoned.d.ts +21 -21
- package/dist/zoned/interval/intervalDivideEquallyZoned.js +79 -99
- package/dist/zoned/interval/intervalEngulfsZoned.d.ts +2 -2
- package/dist/zoned/interval/intervalEngulfsZoned.js +64 -69
- package/dist/zoned/interval/intervalFromDurationZoned.d.ts +39 -37
- package/dist/zoned/interval/intervalFromDurationZoned.js +85 -91
- package/dist/zoned/interval/intervalIntersectionZoned.d.ts +12 -12
- package/dist/zoned/interval/intervalIntersectionZoned.js +76 -81
- package/dist/zoned/interval/intervalLengthZoned.d.ts +6 -6
- package/dist/zoned/interval/intervalLengthZoned.js +60 -73
- package/dist/zoned/interval/intervalOverlappingDaysZoned.d.ts +3 -3
- package/dist/zoned/interval/intervalOverlappingDaysZoned.js +89 -99
- package/dist/zoned/interval/intervalSplitAtZoned.d.ts +12 -12
- package/dist/zoned/interval/intervalSplitAtZoned.js +84 -93
- package/dist/zoned/interval/intervalUnionZoned.d.ts +12 -12
- package/dist/zoned/interval/intervalUnionZoned.js +78 -82
- package/dist/zoned/interval/intervalXorAllZoned.d.ts +14 -14
- package/dist/zoned/interval/intervalXorAllZoned.js +61 -74
- package/dist/zoned/interval/intervalXorZoned.d.ts +12 -12
- package/dist/zoned/interval/intervalXorZoned.js +82 -88
- package/dist/zoned/interval/intervalsOverlapZoned.d.ts +3 -3
- package/dist/zoned/interval/intervalsOverlapZoned.js +64 -69
- package/dist/zoned/interval/mergeIntervalsZoned.d.ts +14 -14
- package/dist/zoned/interval/mergeIntervalsZoned.js +65 -77
- package/dist/zoned/interval/splitIntervalByUnitZoned.d.ts +22 -21
- package/dist/zoned/interval/splitIntervalByUnitZoned.js +93 -112
- package/dist/zoned/interval/validate/index.d.ts +3 -2
- package/dist/zoned/interval/validate/index.js +4 -2
- package/dist/zoned/interval/validate/isValidCalendarZonedInterval.d.ts +3 -3
- package/dist/zoned/interval/validate/isValidCalendarZonedInterval.js +47 -46
- package/dist/zoned/interval/validate/isValidZonedInterval.d.ts +2 -2
- package/dist/zoned/interval/validate/isValidZonedInterval.js +38 -37
- package/dist/zoned/map/index.d.ts +3 -2
- package/dist/zoned/map/index.js +4 -2
- package/dist/zoned/map/mapZonedDatesInRange.d.ts +12 -10
- package/dist/zoned/map/mapZonedDatesInRange.js +67 -87
- package/dist/zoned/map/mapZonedHoursInDay.d.ts +2 -2
- package/dist/zoned/map/mapZonedHoursInDay.js +37 -37
- package/dist/zoned/parse/getZonedOffset.d.ts +2 -2
- package/dist/zoned/parse/getZonedOffset.js +28 -27
- package/dist/zoned/parse/getZonedOffsetAs.d.ts +7 -7
- package/dist/zoned/parse/getZonedOffsetAs.js +41 -45
- package/dist/zoned/parse/index.d.ts +21 -20
- package/dist/zoned/parse/index.js +22 -20
- package/dist/zoned/parse/parseDateFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseDateFromZoned.js +24 -24
- package/dist/zoned/parse/parseDateTimeFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseDateTimeFromZoned.js +25 -24
- package/dist/zoned/parse/parseDayFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseDayFromZoned.js +24 -24
- package/dist/zoned/parse/parseDayOfWeekFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseDayOfWeekFromZoned.js +25 -25
- package/dist/zoned/parse/parseHourFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseHourFromZoned.js +24 -24
- package/dist/zoned/parse/parseMicrosecondFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseMicrosecondFromZoned.js +25 -25
- package/dist/zoned/parse/parseMillisecondFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseMillisecondFromZoned.js +24 -24
- package/dist/zoned/parse/parseMinuteFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseMinuteFromZoned.js +24 -24
- package/dist/zoned/parse/parseMonthFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseMonthFromZoned.js +24 -24
- package/dist/zoned/parse/parseNanosecondFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseNanosecondFromZoned.js +25 -25
- package/dist/zoned/parse/parseRfc2822.d.ts +1 -1
- package/dist/zoned/parse/parseRfc2822.js +67 -70
- package/dist/zoned/parse/parseRfc3339.d.ts +1 -1
- package/dist/zoned/parse/parseRfc3339.js +45 -46
- package/dist/zoned/parse/parseSecondFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseSecondFromZoned.js +24 -24
- package/dist/zoned/parse/parseTimeFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseTimeFromZoned.js +24 -24
- package/dist/zoned/parse/parseTimeZoneFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseTimeZoneFromZoned.js +24 -23
- package/dist/zoned/parse/parseUnitFromZoned.d.ts +11 -11
- package/dist/zoned/parse/parseUnitFromZoned.js +73 -93
- package/dist/zoned/parse/parseWeekFromZoned.d.ts +10 -10
- package/dist/zoned/parse/parseWeekFromZoned.js +44 -49
- package/dist/zoned/parse/parseYearFromZoned.d.ts +1 -1
- package/dist/zoned/parse/parseYearFromZoned.js +27 -26
- package/dist/zoned/validate/hasDaylightSaving.d.ts +12 -12
- package/dist/zoned/validate/hasDaylightSaving.js +60 -63
- package/dist/zoned/validate/index.d.ts +8 -7
- package/dist/zoned/validate/index.js +9 -7
- package/dist/zoned/validate/isValidCalendarZonedDateTime.d.ts +15 -10
- package/dist/zoned/validate/isValidCalendarZonedDateTime.js +12 -55
- package/dist/zoned/validate/isValidRfc2822DateTime.d.ts +7 -2
- package/dist/zoned/validate/isValidRfc2822DateTime.js +6 -33
- package/dist/zoned/validate/isValidRfc3339DateTime.d.ts +7 -2
- package/dist/zoned/validate/isValidRfc3339DateTime.js +6 -32
- package/dist/zoned/validate/isValidTimeZone.d.ts +7 -2
- package/dist/zoned/validate/isValidTimeZone.js +7 -49
- package/dist/zoned/validate/isValidZonedDateTime.d.ts +14 -9
- package/dist/zoned/validate/isValidZonedDateTime.js +14 -57
- package/dist/zoned/validate/isValidZonedRange.d.ts +18 -18
- package/dist/zoned/validate/isValidZonedRange.js +52 -65
- package/package.json +134 -26
- package/skills/gmt-arithmetic/SKILL.md +104 -64
- package/skills/gmt-basics/SKILL.md +73 -19
- package/skills/gmt-gnss/SKILL.md +92 -0
- package/skills/gmt-integration/SKILL.md +99 -33
- package/skills/gmt-intermodal/SKILL.md +191 -0
- package/skills/gmt-timezone/SKILL.md +94 -259
- package/skills/gmt-transport/SKILL.md +133 -0
- package/skills/gmt-workforce/SKILL.md +84 -0
- package/dist/duty/calculate/dutyDayFor.js +0 -71
- package/dist/duty/calculate/dutyTotals.js +0 -41
- package/dist/duty/calculate/dutyViolations.js +0 -65
- package/dist/duty/calculate/evaluateDutyLog.js +0 -75
- package/dist/duty/calculate/index.d.ts +0 -7
- package/dist/duty/calculate/index.js +0 -7
- package/dist/duty/calculate/longestRun.js +0 -54
- package/dist/duty/calculate/qualifyingRestPairs.js +0 -58
- package/dist/duty/calculate/qualifyingRests.js +0 -49
- package/dist/duty/index.d.ts +0 -3
- package/dist/duty/index.js +0 -4
- package/dist/duty/validate/index.d.ts +0 -1
- package/dist/duty/validate/index.js +0 -1
- package/dist/duty/validate/isValidDutyLog.js +0 -34
- package/dist/plain/validate/isLeapSecond.js +0 -40
|
@@ -1,1746 +1,1411 @@
|
|
|
1
|
-
import { Temporal } from "
|
|
2
|
-
import {
|
|
3
|
-
import { calendarScale, datePlusDays, localDateOf, operatorDayScale, periodAfter, periodsEndingAt, resolveWallClock, WallClockRejected, } from "./dutyPeriods.js";
|
|
4
|
-
import { MAX_PERIOD_COUNT, parseDutyRules, usesOperatorDays, } from "./dutyRules.js";
|
|
1
|
+
import { Temporal } from "./temporal.js";
|
|
2
|
+
import { MIN_EPOCH_NANOSECONDS } from "./epochNanoseconds.js";
|
|
5
3
|
import { isObject } from "./isObject.js";
|
|
6
|
-
import { parseScheduleDisambiguation } from "./operatingSchedule.js";
|
|
7
|
-
import { formatHourDuration } from "./hourDurationString.js";
|
|
8
|
-
import { coalesceIntervalNanoseconds } from "./intervalNanoseconds.js";
|
|
9
4
|
import { zoneFrame } from "./zoneFrame.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import { formatHourDuration } from "./hourDurationString.js";
|
|
6
|
+
import { parseScheduleDisambiguation } from "./operatingSchedule.js";
|
|
7
|
+
import { WallClockRejected, calendarScale, datePlusDays, localDateOf, operatorDayScale, parseDayStartTime, periodAfter, periodsEndingAt, resolveWallClock } from "./dutyPeriods.js";
|
|
8
|
+
import { parseDutyLog } from "./dutyLog.js";
|
|
9
|
+
import { MAX_PERIOD_COUNT, parseDutyRules, usesOperatorDays } from "./dutyRules.js";
|
|
10
|
+
import { countEvents, countInRange, createRunStore, endingAtOrBefore, entryHolding, firstEndingAfter, firstEntryIn, firstStartingAtOrAfter, firstWhere, interruptionResetAt, lastAtLeastUntil, lastEntryBefore, latestAtLeast, latestPairFrom, logStartBefore, runEndingAt, runIndex, runsMatching, runsUntil, timeInBefore, viewRun } from "./dutyRunIndex.js";
|
|
11
|
+
|
|
12
|
+
// src/internal/dutyEngine.ts
|
|
13
13
|
/** A window a call cannot place in Temporal's range. Caught by the public function. */
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
var Unrepresentable = class extends RangeError {};
|
|
16
15
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
* A count as a number, exactly. Past `Number.MAX_SAFE_INTEGER` a number would round it, so the
|
|
17
|
+
* call is refused instead.
|
|
18
|
+
*/
|
|
20
19
|
function exactCount(value) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
return Number(value);
|
|
20
|
+
if (value > BigInt(Number.MAX_SAFE_INTEGER)) throw new Unrepresentable("a count past the safe integers");
|
|
21
|
+
return Number(value);
|
|
25
22
|
}
|
|
26
|
-
const duration = (nanoseconds) => ({
|
|
27
|
-
duration: nanoseconds > 0n ? nanoseconds : 0n,
|
|
28
|
-
});
|
|
23
|
+
const duration = (nanoseconds) => ({ duration: nanoseconds > 0n ? nanoseconds : 0n });
|
|
29
24
|
const tally = (value) => ({ count: value > 0 ? value : 0 });
|
|
30
|
-
const max = (a, b) =>
|
|
31
|
-
const min = (a, b) =>
|
|
25
|
+
const max = (a, b) => a > b ? a : b;
|
|
26
|
+
const min = (a, b) => a < b ? a : b;
|
|
32
27
|
const length = (run) => run.end - run.start;
|
|
33
28
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
scales: new Map(),
|
|
68
|
-
wallClocks: new Map(),
|
|
69
|
-
windowInstances: new Map(),
|
|
70
|
-
runs: new Map(),
|
|
71
|
-
},
|
|
72
|
-
rules: resolved,
|
|
73
|
-
};
|
|
29
|
+
* Read the log, rules and options `evaluateDutyLog` and `dutyViolations` take, all-or-nothing.
|
|
30
|
+
*
|
|
31
|
+
* - `options` must be an object with a valid `timeZone`; `dayStartTime` is optional, but a rule
|
|
32
|
+
* that counts operator days needs it; `disambiguation` is `"compatible"` when absent. Each
|
|
33
|
+
* member is read once.
|
|
34
|
+
*
|
|
35
|
+
* @param log candidate duty log
|
|
36
|
+
* @param rules candidate rules
|
|
37
|
+
* @param options candidate `{ timeZone, dayStartTime?, disambiguation? }`
|
|
38
|
+
* @returns the context and resolved rules, or null on invalid input
|
|
39
|
+
*/
|
|
40
|
+
function prepareDutyCall(log, rules, options) {
|
|
41
|
+
const entries = parseDutyLog(log);
|
|
42
|
+
const resolved = parseDutyRules(rules);
|
|
43
|
+
if (entries === null || resolved === null || !isObject(options)) return null;
|
|
44
|
+
const { timeZone, dayStartTime } = options;
|
|
45
|
+
const disambiguation = parseScheduleDisambiguation(options);
|
|
46
|
+
const frame = zoneFrame(timeZone);
|
|
47
|
+
const time = dayStartTime === void 0 ? null : parseDayStartTime(dayStartTime);
|
|
48
|
+
if (frame === null || disambiguation === null || dayStartTime !== void 0 && time === null || time === null && resolved.some(usesOperatorDays)) return null;
|
|
49
|
+
return {
|
|
50
|
+
context: {
|
|
51
|
+
entries,
|
|
52
|
+
frame,
|
|
53
|
+
dayStartTime: time,
|
|
54
|
+
disambiguation,
|
|
55
|
+
scales: /* @__PURE__ */ new Map(),
|
|
56
|
+
wallClocks: /* @__PURE__ */ new Map(),
|
|
57
|
+
windowInstances: /* @__PURE__ */ new Map(),
|
|
58
|
+
store: createRunStore(entries)
|
|
59
|
+
},
|
|
60
|
+
rules: resolved
|
|
61
|
+
};
|
|
74
62
|
}
|
|
75
63
|
function scaleFor(context, unit) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
scale = operatorDayScale(context.frame, context.dayStartTime, context.disambiguation);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
scale = calendarScale(context.frame, unit);
|
|
89
|
-
}
|
|
90
|
-
context.scales.set(unit, scale);
|
|
91
|
-
return scale;
|
|
64
|
+
const known = context.scales.get(unit);
|
|
65
|
+
if (known !== void 0) return known;
|
|
66
|
+
let scale;
|
|
67
|
+
if (unit === "operatorDay") {
|
|
68
|
+
if (context.dayStartTime === null) throw new Unrepresentable("operator days need dayStartTime");
|
|
69
|
+
scale = operatorDayScale(context.frame, context.dayStartTime, context.disambiguation);
|
|
70
|
+
} else scale = calendarScale(context.frame, unit);
|
|
71
|
+
context.scales.set(unit, scale);
|
|
72
|
+
return scale;
|
|
92
73
|
}
|
|
93
|
-
/** The log as it stands at `at`: later entries dropped, one straddling `at` cut there. */
|
|
94
|
-
function clip(entries, at) {
|
|
95
|
-
const clipped = [];
|
|
96
|
-
for (const entry of entries) {
|
|
97
|
-
if (entry.start >= at) {
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
clipped.push(entry.end > at ? { ...entry, end: at } : entry);
|
|
101
|
-
}
|
|
102
|
-
return clipped;
|
|
103
|
-
}
|
|
104
|
-
const matches = (test, status) => typeof test === "function" ? test(status) : test.has(status);
|
|
105
74
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
statuses.add(status);
|
|
123
|
-
}
|
|
124
|
-
return statuses;
|
|
75
|
+
* Read a status list a helper takes: an array of strings, `[]` allowed. Each element is read once.
|
|
76
|
+
*
|
|
77
|
+
* @param value candidate status list
|
|
78
|
+
* @returns the statuses, or null when `value` is not an array of strings
|
|
79
|
+
*/
|
|
80
|
+
function readStatusList(value) {
|
|
81
|
+
if (!Array.isArray(value)) return null;
|
|
82
|
+
const statuses = /* @__PURE__ */ new Set();
|
|
83
|
+
const count = value.length;
|
|
84
|
+
for (let index = 0; index < count; index++) {
|
|
85
|
+
const status = value[index];
|
|
86
|
+
if (typeof status !== "string") return null;
|
|
87
|
+
statuses.add(status);
|
|
88
|
+
}
|
|
89
|
+
return statuses;
|
|
125
90
|
}
|
|
126
91
|
/**
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
.filter((entry) => matches(test, entry.status))
|
|
133
|
-
.map(({ start, end }) => ({ start, end, startText: "", endText: "" }))).map(({ start, end }) => ({ start, end }));
|
|
134
|
-
}
|
|
135
|
-
/** The runs of the whole log in a set of statuses, found once per call and kept. */
|
|
136
|
-
function logRuns(context, statuses) {
|
|
137
|
-
const known = context.runs.get(statuses);
|
|
138
|
-
if (known !== undefined) {
|
|
139
|
-
return known;
|
|
140
|
-
}
|
|
141
|
-
const found = runsOf(context.entries, statuses);
|
|
142
|
-
context.runs.set(statuses, found);
|
|
143
|
-
return found;
|
|
92
|
+
* Maximal runs of touching entries whose status passes `test`, merged as `mergeIntervals` merges
|
|
93
|
+
* them (CORE-6): touching entries join, and a gap or another status ends a run.
|
|
94
|
+
*/
|
|
95
|
+
function runsOf(log, test) {
|
|
96
|
+
return runsMatching(log, (status) => test.has(status));
|
|
144
97
|
}
|
|
145
98
|
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
99
|
+
* The parts of ordered, separate runs inside `[from, to)`, empty parts dropped: `clipRuns`, with
|
|
100
|
+
* the runs before `from` skipped by a binary search instead of read one by one.
|
|
101
|
+
*/
|
|
149
102
|
function runsBetween(runs, from, to) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
inside.push({ start: max(run.start, from), end: min(run.end, to) });
|
|
169
|
-
}
|
|
170
|
-
return inside;
|
|
103
|
+
let low = 0;
|
|
104
|
+
let high = runs.length;
|
|
105
|
+
for (let step = 0; step < 33 && low < high; step++) {
|
|
106
|
+
const middle = low + high >> 1;
|
|
107
|
+
if (runs[middle].end <= from) low = middle + 1;
|
|
108
|
+
else high = middle;
|
|
109
|
+
}
|
|
110
|
+
const inside = [];
|
|
111
|
+
for (let index = low; index < runs.length; index++) {
|
|
112
|
+
const run = runs[index];
|
|
113
|
+
if (run.start >= to) break;
|
|
114
|
+
inside.push({
|
|
115
|
+
start: max(run.start, from),
|
|
116
|
+
end: min(run.end, to)
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return inside;
|
|
171
120
|
}
|
|
172
121
|
/** The parts of runs inside `[from, to)`, empty parts dropped. */
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
122
|
+
function clipRuns(runs, from, to) {
|
|
123
|
+
const clipped = [];
|
|
124
|
+
for (const run of runs) {
|
|
125
|
+
const start = max(run.start, from);
|
|
126
|
+
const end = min(run.end, to);
|
|
127
|
+
if (start < end) clipped.push({
|
|
128
|
+
start,
|
|
129
|
+
end
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return clipped;
|
|
183
133
|
}
|
|
184
134
|
/** Time in `statuses` inside `[from, to)`. */
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
return total;
|
|
195
|
-
}
|
|
196
|
-
/** The latest run at least `minimum` long. */
|
|
197
|
-
function lastAtLeast(runs, minimum) {
|
|
198
|
-
for (let index = runs.length - 1; index >= 0; index--) {
|
|
199
|
-
const run = runs[index];
|
|
200
|
-
if (length(run) >= minimum) {
|
|
201
|
-
return run;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return undefined;
|
|
135
|
+
function timeIn(log, statuses, from, to) {
|
|
136
|
+
let total = 0n;
|
|
137
|
+
for (const entry of log) if (statuses.has(entry.status)) {
|
|
138
|
+
const start = max(entry.start, from);
|
|
139
|
+
const end = min(entry.end, to);
|
|
140
|
+
total += end > start ? end - start : 0n;
|
|
141
|
+
}
|
|
142
|
+
return total;
|
|
205
143
|
}
|
|
206
144
|
/**
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return pairs;
|
|
145
|
+
* The paired rests among runs of rest: two runs in a row, each shorter than `fullRest` and at
|
|
146
|
+
* least `pair.each`, the longer at least `pair.one` and both together at least `pair.combined`.
|
|
147
|
+
*
|
|
148
|
+
* - A run of `fullRest` or more is a rest on its own: it pairs with nothing, and no pair spans it.
|
|
149
|
+
* - A run shorter than `pair.each` is neither half of a pair nor a break between two runs.
|
|
150
|
+
* - Pairs may chain: of runs a, b and c, both (a, b) and (b, c) are returned when both qualify.
|
|
151
|
+
*
|
|
152
|
+
* @param runs runs of rest, in order
|
|
153
|
+
* @param fullRest the length at which a run is a full rest
|
|
154
|
+
* @param pair the three floors
|
|
155
|
+
* @returns the qualifying pairs, in order
|
|
156
|
+
*/
|
|
157
|
+
function restPairs(runs, fullRest, pair) {
|
|
158
|
+
const pairs = [];
|
|
159
|
+
let previous;
|
|
160
|
+
for (const run of runs) {
|
|
161
|
+
const taken = length(run);
|
|
162
|
+
if (taken >= fullRest) {
|
|
163
|
+
previous = void 0;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (taken < pair.each) continue;
|
|
167
|
+
if (previous !== void 0) {
|
|
168
|
+
const before = length(previous);
|
|
169
|
+
if (max(before, taken) >= pair.one && before + taken >= pair.combined) pairs.push({
|
|
170
|
+
first: previous,
|
|
171
|
+
second: run
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
previous = run;
|
|
175
|
+
}
|
|
176
|
+
return pairs;
|
|
240
177
|
}
|
|
241
178
|
/** A period repeated `times` over: `times` × its length, or `times` × its count. */
|
|
242
179
|
function repeated(period, times) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
180
|
+
return period.kind === "elapsed" ? {
|
|
181
|
+
kind: "elapsed",
|
|
182
|
+
length: period.length * BigInt(times)
|
|
183
|
+
} : {
|
|
184
|
+
...period,
|
|
185
|
+
count: period.count * times
|
|
186
|
+
};
|
|
246
187
|
}
|
|
247
188
|
/** The window a period names at `at`: sliding for elapsed time, whole periods otherwise. */
|
|
248
189
|
function windowOf(context, period, at, anchor) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
190
|
+
if (period.kind === "elapsed") return {
|
|
191
|
+
span: {
|
|
192
|
+
start: max(at - period.length, MIN_EPOCH_NANOSECONDS),
|
|
193
|
+
end: at
|
|
194
|
+
},
|
|
195
|
+
basis: "elapsed",
|
|
196
|
+
rolling: true
|
|
197
|
+
};
|
|
198
|
+
const scale = scaleFor(context, period.unit);
|
|
199
|
+
const span = periodsEndingAt(scale, period.count, anchor);
|
|
200
|
+
if (span === null) throw new Unrepresentable("period outside the instant range");
|
|
201
|
+
return {
|
|
202
|
+
span,
|
|
203
|
+
basis: scale.basis,
|
|
204
|
+
rolling: period.count > 1
|
|
205
|
+
};
|
|
265
206
|
}
|
|
266
207
|
/** The end of the `periods`-th period, the one `from` falls in counting as the first. */
|
|
267
208
|
function boundaryAfter(context, period, periods, from) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
? null
|
|
275
|
-
: periodAfter(scale, first, period.count * periods - 1);
|
|
276
|
-
if (last === null) {
|
|
277
|
-
throw new Unrepresentable("period outside the instant range");
|
|
278
|
-
}
|
|
279
|
-
return last.end;
|
|
209
|
+
if (period.kind === "elapsed") return from + period.length * BigInt(periods);
|
|
210
|
+
const scale = scaleFor(context, period.unit);
|
|
211
|
+
const first = scale.containing(from);
|
|
212
|
+
const last = first === null ? null : periodAfter(scale, first, period.count * periods - 1);
|
|
213
|
+
if (last === null) throw new Unrepresentable("period outside the instant range");
|
|
214
|
+
return last.end;
|
|
280
215
|
}
|
|
281
216
|
const basisOf = (window) => window.basis;
|
|
282
217
|
const groupingOf = (window) => window.rolling ? "slide" : "period";
|
|
283
218
|
/** A cap: holds while `used` is at most `limit`. */
|
|
284
219
|
function capped(used, limit, rest) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
220
|
+
const usedValue = "duration" in used ? used.duration : BigInt(used.count);
|
|
221
|
+
const limitValue = "duration" in limit ? limit.duration : BigInt(limit.count);
|
|
222
|
+
const remaining = limitValue - usedValue;
|
|
223
|
+
return {
|
|
224
|
+
satisfied: usedValue <= limitValue,
|
|
225
|
+
used,
|
|
226
|
+
limit,
|
|
227
|
+
remaining: "duration" in limit ? duration(remaining) : tally(Number(remaining)),
|
|
228
|
+
excess: usedValue - limitValue,
|
|
229
|
+
...rest
|
|
230
|
+
};
|
|
296
231
|
}
|
|
297
232
|
/** A floor: holds while `used` is at least `limit`, or `met` says otherwise. */
|
|
298
233
|
function floored(used, limit, met, rest) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
234
|
+
return {
|
|
235
|
+
satisfied: met,
|
|
236
|
+
used: duration(used),
|
|
237
|
+
limit: duration(limit),
|
|
238
|
+
remaining: duration(limit - used),
|
|
239
|
+
excess: limit - used,
|
|
240
|
+
...rest
|
|
241
|
+
};
|
|
307
242
|
}
|
|
308
243
|
/** How a list of rest runs measures against a `restRequirement`'s floors. */
|
|
309
244
|
function restChecks(rule, lengths) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
245
|
+
const sorted = [...lengths].sort((a, b) => a > b ? -1 : a < b ? 1 : 0);
|
|
246
|
+
const longest = sorted[0] ?? 0n;
|
|
247
|
+
const checks = [];
|
|
248
|
+
let counted = sorted.reduce((sum, value) => sum + value, 0n);
|
|
249
|
+
if (rule.composition !== null) {
|
|
250
|
+
const { maxPeriods, longestAtLeast, othersAtLeast } = rule.composition;
|
|
251
|
+
const others = sorted.slice(1).filter((value) => value >= othersAtLeast).slice(0, maxPeriods - 1);
|
|
252
|
+
counted = min(counted, others.reduce((sum, value) => sum + value, longest));
|
|
253
|
+
checks.push({
|
|
254
|
+
used: longest,
|
|
255
|
+
limit: longestAtLeast
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
if (rule.composite !== null) {
|
|
259
|
+
const { consecutive, additional, blockMinimum } = rule.composite;
|
|
260
|
+
const blocks = sorted.slice(1).filter((value) => value >= blockMinimum).reduce((sum, value) => sum + value, 0n);
|
|
261
|
+
checks.push({
|
|
262
|
+
used: longest,
|
|
263
|
+
limit: consecutive
|
|
264
|
+
});
|
|
265
|
+
checks.push({
|
|
266
|
+
used: max(longest - consecutive, 0n) + blocks,
|
|
267
|
+
limit: additional
|
|
268
|
+
});
|
|
269
|
+
counted = min(counted, longest + blocks);
|
|
270
|
+
}
|
|
271
|
+
checks.push({
|
|
272
|
+
used: counted,
|
|
273
|
+
limit: rule.minimum
|
|
274
|
+
});
|
|
275
|
+
const failing = checks.find((check) => check.used < check.limit);
|
|
276
|
+
return {
|
|
277
|
+
met: failing === void 0,
|
|
278
|
+
failing,
|
|
279
|
+
total: checks[checks.length - 1]
|
|
280
|
+
};
|
|
344
281
|
}
|
|
345
282
|
/** Rest runs with rest added from `at` to `end`, joined to a run that reaches `at`. */
|
|
346
283
|
function withRestUntil(runs, at, end) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
284
|
+
const last = runs[runs.length - 1];
|
|
285
|
+
return last !== void 0 && last.end === at ? [...runs.slice(0, -1), {
|
|
286
|
+
start: last.start,
|
|
287
|
+
end
|
|
288
|
+
}] : [...runs, {
|
|
289
|
+
start: at,
|
|
290
|
+
end
|
|
291
|
+
}];
|
|
351
292
|
}
|
|
352
293
|
/** `resolveWallClock` under the call's policy, each local date-time resolved once per call. */
|
|
353
294
|
function wallClockOf(context, date, time) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
context.wallClocks.set(key, resolved);
|
|
361
|
-
return resolved;
|
|
295
|
+
const key = `${date.toString()}T${time.toString()}`;
|
|
296
|
+
const known = context.wallClocks.get(key);
|
|
297
|
+
if (known !== void 0) return known;
|
|
298
|
+
const resolved = resolveWallClock(context.frame, date, time, context.disambiguation);
|
|
299
|
+
context.wallClocks.set(key, resolved);
|
|
300
|
+
return resolved;
|
|
362
301
|
}
|
|
363
302
|
/**
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
303
|
+
* The whole local windows inside `[from, to)` in the reference zone, their edges resolved under
|
|
304
|
+
* the call's `disambiguation`.
|
|
305
|
+
*
|
|
306
|
+
* - `strict`: under `"reject"`, a window with a repeated or skipped edge that reaches `[from, to)`
|
|
307
|
+
* throws `WallClockRejected`. Without it, such an edge is read `"compatible"`: for rest that is
|
|
308
|
+
* only supposed (the best case of a window not yet over), or for finding candidate instants.
|
|
309
|
+
*/
|
|
371
310
|
function localWindowsIn(context, window, from, to, strict) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
// Under "reject", a window with a repeated or skipped edge that reaches the run is refused.
|
|
394
|
-
if (strict && instance.rejected && instance.end > from) {
|
|
395
|
-
throw new WallClockRejected("a local window the zone repeats or skips");
|
|
396
|
-
}
|
|
397
|
-
if (instance.start < instance.end &&
|
|
398
|
-
instance.start >= from &&
|
|
399
|
-
instance.end <= to) {
|
|
400
|
-
found.push({ start: instance.start, end: instance.end });
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
return found;
|
|
311
|
+
const found = [];
|
|
312
|
+
const instances = windowInstances(context, window, from, to);
|
|
313
|
+
let low = 0;
|
|
314
|
+
let high = instances.length;
|
|
315
|
+
for (let step = 0; step < 33 && low < high; step++) {
|
|
316
|
+
const middle = low + high >> 1;
|
|
317
|
+
if (instances[middle].end <= from) low = middle + 1;
|
|
318
|
+
else high = middle;
|
|
319
|
+
}
|
|
320
|
+
for (let index = low; index < instances.length; index++) {
|
|
321
|
+
const instance = instances[index];
|
|
322
|
+
if (instance.start >= to) break;
|
|
323
|
+
if (strict && instance.rejected && instance.end > from) throw new WallClockRejected("a local window the zone repeats or skips");
|
|
324
|
+
if (instance.start < instance.end && instance.start >= from && instance.end <= to) found.push({
|
|
325
|
+
start: instance.start,
|
|
326
|
+
end: instance.end
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
return found;
|
|
404
330
|
}
|
|
405
331
|
/** Two days: how far either side of a request the window instances are resolved and kept. */
|
|
406
332
|
const WINDOW_MARGIN = 172800000000000n;
|
|
407
333
|
/** The instances of a local window on the dates `first` to `last`, in date order. */
|
|
408
334
|
function instancesOn(context, window, first, last) {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
rejected: start.rejected || end.rejected,
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
date = next;
|
|
428
|
-
}
|
|
429
|
-
return instances;
|
|
335
|
+
const instances = [];
|
|
336
|
+
let date = first;
|
|
337
|
+
for (let step = 0; date !== null && Temporal.PlainDate.compare(date, last) <= 0; step++) {
|
|
338
|
+
if (step > 2 * 1e4) throw new Unrepresentable("too many local windows");
|
|
339
|
+
const next = datePlusDays(date, 1);
|
|
340
|
+
const start = wallClockOf(context, date, window.from);
|
|
341
|
+
const end = window.wraps && next === null ? null : wallClockOf(context, window.wraps ? next : date, window.to);
|
|
342
|
+
if (start !== null && end !== null) instances.push({
|
|
343
|
+
start: start.at,
|
|
344
|
+
end: end.at,
|
|
345
|
+
rejected: start.rejected || end.rejected
|
|
346
|
+
});
|
|
347
|
+
date = next;
|
|
348
|
+
}
|
|
349
|
+
return instances;
|
|
430
350
|
}
|
|
431
351
|
/** How close a request must be to a stretch already resolved to extend it: thirty days. */
|
|
432
352
|
const WINDOW_JOIN = 2592000000000000n;
|
|
433
353
|
/**
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
354
|
+
* Every instance of a local window on the local dates around `[from, to)`, resolved once per call
|
|
355
|
+
* and kept, so each later evaluation only filters them.
|
|
356
|
+
*
|
|
357
|
+
* - A request near a stretch of dates already kept resolves only the dates it adds, so a scan
|
|
358
|
+
* that moves along the log resolves each date once. A request far from every stretch starts a
|
|
359
|
+
* stretch of its own: the dates between two far-apart rests are never resolved.
|
|
360
|
+
* - One request may need at most `2 × MAX_PERIOD_COUNT` dates; past that it throws
|
|
361
|
+
* `Unrepresentable`. What is kept from earlier requests does not count against it.
|
|
362
|
+
*/
|
|
443
363
|
function windowInstances(context, window, from, to) {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
...(before !== null && Temporal.PlainDate.compare(first, before) <= 0
|
|
479
|
-
? instancesOn(context, window, first, before)
|
|
480
|
-
: []),
|
|
481
|
-
...known.instances,
|
|
482
|
-
...(after !== null && Temporal.PlainDate.compare(after, last) <= 0
|
|
483
|
-
? instancesOn(context, window, after, last)
|
|
484
|
-
: []),
|
|
485
|
-
];
|
|
486
|
-
}
|
|
487
|
-
const stretch = { from: spanFrom, to: spanTo, first, last, instances };
|
|
488
|
-
context.windowInstances.set(key, [
|
|
489
|
-
...stretches.filter((other) => other !== known),
|
|
490
|
-
stretch,
|
|
491
|
-
]);
|
|
492
|
-
return instances;
|
|
364
|
+
const key = `${window.from.toString()}-${window.to.toString()}`;
|
|
365
|
+
const stretches = context.windowInstances.get(key) ?? [];
|
|
366
|
+
const covering = stretches.find((stretch) => stretch.from <= from && stretch.to >= to);
|
|
367
|
+
if (covering !== void 0) return covering.instances;
|
|
368
|
+
const wantedFrom = from - WINDOW_MARGIN;
|
|
369
|
+
const wantedTo = to + WINDOW_MARGIN;
|
|
370
|
+
const wanted = datePlusDays(localDateOf(context.frame, wantedFrom), -1);
|
|
371
|
+
const until = localDateOf(context.frame, wantedTo - 1n);
|
|
372
|
+
if (wanted === null || wanted.until(until, { largestUnit: "day" }).days > 2 * 1e4) throw new Unrepresentable("too many local windows");
|
|
373
|
+
const known = stretches.find((stretch) => stretch.from - WINDOW_JOIN <= wantedTo && stretch.to + WINDOW_JOIN >= wantedFrom);
|
|
374
|
+
const spanFrom = known === void 0 ? wantedFrom : min(known.from, wantedFrom);
|
|
375
|
+
const spanTo = known === void 0 ? wantedTo : max(known.to, wantedTo);
|
|
376
|
+
const first = known !== void 0 && Temporal.PlainDate.compare(known.first, wanted) < 0 ? known.first : wanted;
|
|
377
|
+
const last = known !== void 0 && Temporal.PlainDate.compare(known.last, until) > 0 ? known.last : until;
|
|
378
|
+
let instances;
|
|
379
|
+
if (known === void 0) instances = instancesOn(context, window, first, last);
|
|
380
|
+
else {
|
|
381
|
+
const before = datePlusDays(known.first, -1);
|
|
382
|
+
const after = datePlusDays(known.last, 1);
|
|
383
|
+
instances = [
|
|
384
|
+
...before !== null && Temporal.PlainDate.compare(first, before) <= 0 ? instancesOn(context, window, first, before) : [],
|
|
385
|
+
...known.instances,
|
|
386
|
+
...after !== null && Temporal.PlainDate.compare(after, last) <= 0 ? instancesOn(context, window, after, last) : []
|
|
387
|
+
];
|
|
388
|
+
}
|
|
389
|
+
const stretch = {
|
|
390
|
+
from: spanFrom,
|
|
391
|
+
to: spanTo,
|
|
392
|
+
first,
|
|
393
|
+
last,
|
|
394
|
+
instances
|
|
395
|
+
};
|
|
396
|
+
context.windowInstances.set(key, [...stretches.filter((other) => other !== known), stretch]);
|
|
397
|
+
return instances;
|
|
493
398
|
}
|
|
494
399
|
/** How many free periods one run of rest holds. */
|
|
495
400
|
function freePeriodsIn(context, rule, run, strict) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
break;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
const last = instances[first + count - 1];
|
|
515
|
-
const end = last === undefined ? null : max(cursor + rule.minimum, last.end);
|
|
516
|
-
if (end === null || end > run.end) {
|
|
517
|
-
break;
|
|
518
|
-
}
|
|
519
|
-
found++;
|
|
520
|
-
cursor = end;
|
|
521
|
-
}
|
|
522
|
-
return BigInt(found);
|
|
401
|
+
if (rule.containing === null) return length(run) / rule.minimum;
|
|
402
|
+
const { window, count } = rule.containing;
|
|
403
|
+
const instances = localWindowsIn(context, window, run.start, run.end, strict);
|
|
404
|
+
let cursor = run.start;
|
|
405
|
+
let first = 0;
|
|
406
|
+
let found = 0;
|
|
407
|
+
for (let step = 0; step <= instances.length; step++) {
|
|
408
|
+
for (; first < instances.length; first++) if (instances[first].start >= cursor) break;
|
|
409
|
+
const last = instances[first + count - 1];
|
|
410
|
+
const end = last === void 0 ? null : max(cursor + rule.minimum, last.end);
|
|
411
|
+
if (end === null || end > run.end) break;
|
|
412
|
+
found++;
|
|
413
|
+
cursor = end;
|
|
414
|
+
}
|
|
415
|
+
return BigInt(found);
|
|
523
416
|
}
|
|
524
417
|
function evaluateFreePeriod(context, rule, at, anchor) {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
418
|
+
const window = windowOf(context, rule.within, at, anchor);
|
|
419
|
+
const rests = runIndex(context.store, rule.restStatuses).runs;
|
|
420
|
+
const countIn = (from, to, extendTo) => {
|
|
421
|
+
const inside = runsBetween(rests, from, to);
|
|
422
|
+
const runs = extendTo === void 0 ? inside : withRestUntil(inside, at, extendTo);
|
|
423
|
+
const strict = extendTo === void 0;
|
|
424
|
+
return runs.reduce((sum, run) => sum + freePeriodsIn(context, rule, run, strict), 0n);
|
|
425
|
+
};
|
|
426
|
+
const enough = (count) => count >= BigInt(rule.atLeast);
|
|
427
|
+
const { span } = window;
|
|
428
|
+
const found = exactCount(countIn(span.start, min(span.end, at)));
|
|
429
|
+
const unfinished = span.end > at;
|
|
430
|
+
const met = found >= rule.atLeast || unfinished && enough(countIn(span.start, at, span.end));
|
|
431
|
+
let dueBy = null;
|
|
432
|
+
if (found >= rule.atLeast && rule.atLeast > 0) {
|
|
433
|
+
if (rule.within.kind === "elapsed") {
|
|
434
|
+
const windowLength = rule.within.length;
|
|
435
|
+
let low = at;
|
|
436
|
+
let high = at + windowLength;
|
|
437
|
+
for (let step = 0; step < 90 && high - low > 1n; step++) {
|
|
438
|
+
const middle = (low + high) / 2n;
|
|
439
|
+
if (enough(countIn(middle - windowLength, at))) low = middle;
|
|
440
|
+
else high = middle;
|
|
441
|
+
}
|
|
442
|
+
dueBy = low;
|
|
443
|
+
} else {
|
|
444
|
+
const scale = scaleFor(context, rule.within.unit);
|
|
445
|
+
const count = rule.within.count;
|
|
446
|
+
const first = scale.containing(span.start);
|
|
447
|
+
const unitAt = (index) => {
|
|
448
|
+
const found = first === null ? null : periodAfter(scale, first, index);
|
|
449
|
+
if (found === null) throw new Unrepresentable("period outside the instant range");
|
|
450
|
+
return found;
|
|
451
|
+
};
|
|
452
|
+
let low = 1;
|
|
453
|
+
let high = count;
|
|
454
|
+
for (let step = 0; step < 32 && low < high; step++) {
|
|
455
|
+
const middle = low + high >> 1;
|
|
456
|
+
if (!enough(countIn(unitAt(middle).start, at))) high = middle;
|
|
457
|
+
else low = middle + 1;
|
|
458
|
+
}
|
|
459
|
+
dueBy = unitAt(low + count - 1).end;
|
|
460
|
+
}
|
|
461
|
+
} else if (met) dueBy = span.end;
|
|
462
|
+
return {
|
|
463
|
+
satisfied: met,
|
|
464
|
+
used: tally(found),
|
|
465
|
+
limit: tally(rule.atLeast),
|
|
466
|
+
remaining: tally(rule.atLeast - found),
|
|
467
|
+
window: span,
|
|
468
|
+
periodBasis: basisOf(window),
|
|
469
|
+
dueBy,
|
|
470
|
+
resetAt: null,
|
|
471
|
+
excess: BigInt(rule.atLeast - found),
|
|
472
|
+
grouping: groupingOf(window)
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* The stretches without rest in the log as it stood at `at`: each runs from the end of one rest to
|
|
477
|
+
* the start of the next, the last to `at` (or nowhere, when a rest reaches `at`). The log's first
|
|
478
|
+
* entry starts one too, as a rest ending there would: time before the log is unknown, but the work
|
|
479
|
+
* logged before the first rest is a stretch without rest like any other.
|
|
480
|
+
*/
|
|
481
|
+
function restGaps(rests, logStart, at) {
|
|
482
|
+
const taken = rests.count;
|
|
483
|
+
const resting = rests.last !== void 0 && rests.last.end === at;
|
|
484
|
+
const prepended = logStart !== void 0 && (taken === 0 || viewRun(rests, 0).start !== logStart);
|
|
485
|
+
const startAt = (gap) => prepended ? gap === 0 ? logStart : viewRun(rests, gap - 1).end : viewRun(rests, gap).end;
|
|
486
|
+
const endAt = (gap) => {
|
|
487
|
+
const next = prepended ? gap : gap + 1;
|
|
488
|
+
return next < taken ? viewRun(rests, next).start : resting ? startAt(gap) : at;
|
|
489
|
+
};
|
|
490
|
+
return {
|
|
491
|
+
count: prepended ? taken + 1 : taken,
|
|
492
|
+
resting,
|
|
493
|
+
startAt,
|
|
494
|
+
endAt
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* The longest stretch without rest touching `[from, to)`, found from the first that ends after
|
|
499
|
+
* `from`.
|
|
500
|
+
*/
|
|
501
|
+
function widestGap(gaps, from, to) {
|
|
502
|
+
let widest = 0n;
|
|
503
|
+
for (let gap = firstWhere(gaps.count, (position) => gaps.endAt(position) > from); gap < gaps.count && gaps.startAt(gap) < to; gap++) widest = max(widest, gaps.endAt(gap) - gaps.startAt(gap));
|
|
504
|
+
return widest;
|
|
505
|
+
}
|
|
506
|
+
/** The widest stretch without rest in `[from, upper)` at `at`, and when the next rest falls due. */
|
|
507
|
+
function widestRestGap(context, index, at, from, upper, maxGap) {
|
|
508
|
+
const gaps = restGaps(runsUntil(index, at), logStartBefore(context.store, at), at);
|
|
509
|
+
return {
|
|
510
|
+
widest: widestGap(gaps, from, upper),
|
|
511
|
+
dueBy: gaps.count > 0 && !gaps.resting ? gaps.startAt(gaps.count - 1) + maxGap : null
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
function evaluateRestRequirement(context, rule, at, anchor) {
|
|
515
|
+
const window = windowOf(context, rule.per, at, anchor);
|
|
516
|
+
const { span } = window;
|
|
517
|
+
const index = runIndex(context.store, rule.restStatuses);
|
|
518
|
+
const upper = min(span.end, at);
|
|
519
|
+
const inside = span.start < upper ? runsBetween(index.runs, span.start, upper) : [];
|
|
520
|
+
const actual = restChecks(rule, inside.map(length));
|
|
521
|
+
const met = actual.met || span.end > at && restChecks(rule, withRestUntil(inside, at, span.end).map(length)).met;
|
|
522
|
+
const shown = (met ? void 0 : actual.failing) ?? actual.total;
|
|
523
|
+
const rest = {
|
|
524
|
+
window: span,
|
|
525
|
+
periodBasis: basisOf(window),
|
|
526
|
+
resetAt: null,
|
|
527
|
+
grouping: groupingOf(window)
|
|
528
|
+
};
|
|
529
|
+
if (rule.maxGap !== null) {
|
|
530
|
+
const { widest, dueBy } = widestRestGap(context, index, at, span.start, upper, rule.maxGap);
|
|
531
|
+
if (widest > rule.maxGap) return {
|
|
532
|
+
satisfied: false,
|
|
533
|
+
used: duration(widest),
|
|
534
|
+
limit: duration(rule.maxGap),
|
|
535
|
+
remaining: duration(0n),
|
|
536
|
+
excess: widest - rule.maxGap,
|
|
537
|
+
dueBy,
|
|
538
|
+
...rest
|
|
539
|
+
};
|
|
540
|
+
return floored(shown.used, shown.limit, met, {
|
|
541
|
+
...rest,
|
|
542
|
+
dueBy
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
return floored(shown.used, shown.limit, met, {
|
|
546
|
+
...rest,
|
|
547
|
+
dueBy: null
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
/** The rest right before a duty, measured whole, against the duty before it (`orFactor`). */
|
|
551
|
+
function restBeforeDutyScaled(rule, orFactor, { rests, dutyStart, onDuty, logStart }) {
|
|
552
|
+
const rest = runEndingAt(rests, dutyStart);
|
|
553
|
+
const restStart = rest?.start ?? dutyStart;
|
|
554
|
+
const dutyFrom = latestAtLeast(rests, endingAtOrBefore(rests, restStart), rule.minimum)?.end ?? min(logStart, restStart);
|
|
555
|
+
const previousDuty = restStart - dutyFrom;
|
|
556
|
+
const { numerator, denominator } = orFactor.k;
|
|
557
|
+
const scaled = (previousDuty * numerator + denominator - 1n) / denominator;
|
|
558
|
+
const limit = max(rule.minimum, max(scaled, orFactor.floor));
|
|
559
|
+
const used = rest === void 0 ? 0n : length(rest);
|
|
560
|
+
return {
|
|
561
|
+
...floored(used, limit, !onDuty || used >= limit, {
|
|
562
|
+
window: {
|
|
563
|
+
start: dutyFrom,
|
|
564
|
+
end: dutyStart
|
|
565
|
+
},
|
|
566
|
+
periodBasis: "elapsed",
|
|
567
|
+
dueBy: null,
|
|
568
|
+
resetAt: null,
|
|
569
|
+
grouping: "start"
|
|
570
|
+
}),
|
|
571
|
+
beforeLog: restStart <= logStart,
|
|
572
|
+
key: restStart
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
/** The longest run of rest inside `[windowStart, dutyStart)`, the latest on a tie. */
|
|
576
|
+
function longestRestInside(rests, windowStart, dutyStart) {
|
|
577
|
+
let rest;
|
|
578
|
+
for (let position = firstEndingAfter(rests, windowStart); position < rests.count; position++) {
|
|
579
|
+
const run = viewRun(rests, position);
|
|
580
|
+
if (run.start >= dutyStart) break;
|
|
581
|
+
const inside = min(run.end, dutyStart) - max(run.start, windowStart);
|
|
582
|
+
if (inside > 0n && (rest === void 0 || inside >= rest.inside)) rest = {
|
|
583
|
+
run,
|
|
584
|
+
inside
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
return rest;
|
|
607
588
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
if (rule.maxGap !== null) {
|
|
627
|
-
const last = rests[rests.length - 1];
|
|
628
|
-
const resting = last !== undefined && last.end === at;
|
|
629
|
-
// A stretch without rest runs from the end of one rest to the start of the next. The log's
|
|
630
|
-
// first entry starts one too, as a rest ending there would: time before the log is unknown,
|
|
631
|
-
// but the work logged before the first rest is a stretch without rest like any other.
|
|
632
|
-
const logStart = log[0]?.start;
|
|
633
|
-
const gapStarts = logStart === undefined || rests[0]?.start === logStart
|
|
634
|
-
? rests.map((run) => run.end)
|
|
635
|
-
: [logStart, ...rests.map((run) => run.end)];
|
|
636
|
-
const gapEnds = gapStarts.length > rests.length
|
|
637
|
-
? rests.map((run) => run.start)
|
|
638
|
-
: rests.slice(1).map((run) => run.start);
|
|
639
|
-
let widest = 0n;
|
|
640
|
-
for (let index = 0; index < gapStarts.length; index++) {
|
|
641
|
-
const gapStart = gapStarts[index];
|
|
642
|
-
const gapEnd = gapEnds[index] ?? (resting ? gapStart : at);
|
|
643
|
-
if (gapEnd > span.start && gapStart < min(span.end, at)) {
|
|
644
|
-
widest = max(widest, gapEnd - gapStart);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
const lastGapStart = gapStarts[gapStarts.length - 1];
|
|
648
|
-
const dueBy = lastGapStart !== undefined && !resting
|
|
649
|
-
? lastGapStart + rule.maxGap
|
|
650
|
-
: null;
|
|
651
|
-
if (widest > rule.maxGap) {
|
|
652
|
-
return {
|
|
653
|
-
satisfied: false,
|
|
654
|
-
used: duration(widest),
|
|
655
|
-
limit: duration(rule.maxGap),
|
|
656
|
-
remaining: duration(0n),
|
|
657
|
-
excess: widest - rule.maxGap,
|
|
658
|
-
dueBy,
|
|
659
|
-
...rest,
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
return floored(shown.used, shown.limit, met, {
|
|
663
|
-
...rest,
|
|
664
|
-
dueBy,
|
|
665
|
-
});
|
|
666
|
-
}
|
|
667
|
-
return floored(shown.used, shown.limit, met, {
|
|
668
|
-
...rest,
|
|
669
|
-
dueBy: null,
|
|
670
|
-
});
|
|
589
|
+
/** The rest before a duty: the longest inside the window, against the minimum. */
|
|
590
|
+
function restBeforeDutyWithin(rule, { rests, dutyStart, onDuty }) {
|
|
591
|
+
const windowStart = max(dutyStart - rule.within, MIN_EPOCH_NANOSECONDS);
|
|
592
|
+
const rest = longestRestInside(rests, windowStart, dutyStart);
|
|
593
|
+
const used = rest?.inside ?? 0n;
|
|
594
|
+
return {
|
|
595
|
+
...floored(used, rule.minimum, !onDuty || used >= rule.minimum, {
|
|
596
|
+
window: {
|
|
597
|
+
start: windowStart,
|
|
598
|
+
end: dutyStart
|
|
599
|
+
},
|
|
600
|
+
periodBasis: "elapsed",
|
|
601
|
+
dueBy: null,
|
|
602
|
+
resetAt: null,
|
|
603
|
+
grouping: "start"
|
|
604
|
+
}),
|
|
605
|
+
key: rest?.run.start ?? windowStart
|
|
606
|
+
};
|
|
671
607
|
}
|
|
672
|
-
function evaluateRestBeforeDuty(
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
// The rest judged is the one right before the duty, measured whole, against the duty it
|
|
685
|
-
// ends: from the end of the last rest of at least `minimum` before it, breaks included, to
|
|
686
|
-
// where it starts. A duty between an earlier rest and this one is never skipped, and more
|
|
687
|
-
// rest before the duty only lengthens the rest or shortens the duty before it.
|
|
688
|
-
const rest = rests.find((run) => run.end === dutyStart);
|
|
689
|
-
const restStart = rest?.start ?? dutyStart;
|
|
690
|
-
const fullRest = rests
|
|
691
|
-
.filter((run) => run.end <= restStart && length(run) >= rule.minimum)
|
|
692
|
-
.at(-1);
|
|
693
|
-
const dutyFrom = fullRest?.end ?? min(logStart, restStart);
|
|
694
|
-
const previousDuty = restStart - dutyFrom;
|
|
695
|
-
const { numerator, denominator } = rule.orFactor.k;
|
|
696
|
-
// k × the duty, rounded up to the nanosecond, exactly.
|
|
697
|
-
const scaled = (previousDuty * numerator + denominator - 1n) / denominator;
|
|
698
|
-
const limit = max(rule.minimum, max(scaled, rule.orFactor.floor));
|
|
699
|
-
const used = rest === undefined ? 0n : length(rest);
|
|
700
|
-
return {
|
|
701
|
-
...floored(used, limit, !onDuty || used >= limit, {
|
|
702
|
-
window: { start: dutyFrom, end: dutyStart },
|
|
703
|
-
periodBasis: "elapsed",
|
|
704
|
-
dueBy: null,
|
|
705
|
-
resetAt: null,
|
|
706
|
-
grouping: "start",
|
|
707
|
-
}),
|
|
708
|
-
// A rest that starts with the log, or a duty with none logged before it, may have more
|
|
709
|
-
// rest before the log: the record does not judge it.
|
|
710
|
-
beforeLog: restStart <= logStart,
|
|
711
|
-
key: restStart,
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
const windowStart = max(dutyStart - rule.within, MIN_INSTANT_NANOSECONDS);
|
|
715
|
-
// The rest before the duty: the longest run of rest inside the window, the latest on a tie.
|
|
716
|
-
let rest;
|
|
717
|
-
for (const run of rests) {
|
|
718
|
-
const inside = min(run.end, dutyStart) - max(run.start, windowStart);
|
|
719
|
-
if (inside > 0n && (rest === undefined || inside >= rest.inside)) {
|
|
720
|
-
rest = { run, inside };
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
const used = rest?.inside ?? 0n;
|
|
724
|
-
return {
|
|
725
|
-
...floored(used, rule.minimum, !onDuty || used >= rule.minimum, {
|
|
726
|
-
window: { start: windowStart, end: dutyStart },
|
|
727
|
-
periodBasis: "elapsed",
|
|
728
|
-
dueBy: null,
|
|
729
|
-
resetAt: null,
|
|
730
|
-
grouping: "start",
|
|
731
|
-
}),
|
|
732
|
-
// Every duty start after one short rest is the same failure: the record lists it once.
|
|
733
|
-
key: rest?.run.start ?? windowStart,
|
|
734
|
-
};
|
|
608
|
+
function evaluateRestBeforeDuty(context, rule, at) {
|
|
609
|
+
const { store } = context;
|
|
610
|
+
const rests = runsUntil(runIndex(store, rule.restStatuses), at);
|
|
611
|
+
const last = lastEntryBefore(store, at);
|
|
612
|
+
const onDuty = last !== void 0 && last.end === at && !rule.restStatuses.has(last.status);
|
|
613
|
+
const started = {
|
|
614
|
+
rests,
|
|
615
|
+
dutyStart: onDuty ? runsUntil(runIndex(store, { not: rule.restStatuses }), at).last.start : at,
|
|
616
|
+
onDuty,
|
|
617
|
+
logStart: logStartBefore(store, at) ?? at
|
|
618
|
+
};
|
|
619
|
+
return rule.orFactor === null ? restBeforeDutyWithin(rule, started) : restBeforeDutyScaled(rule, rule.orFactor, started);
|
|
735
620
|
}
|
|
736
621
|
function evaluateRule(context, rule, at, anchor) {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
const latest = blocks[0];
|
|
1052
|
-
return capped(tally(occupied), tally(rule.maximum), {
|
|
1053
|
-
window: { start: earliest.start, end: latest.end },
|
|
1054
|
-
periodBasis: scale.basis,
|
|
1055
|
-
dueBy: null,
|
|
1056
|
-
resetAt: null,
|
|
1057
|
-
grouping: rule.lookback * rule.per.count > 1 ? "slide" : "period",
|
|
1058
|
-
});
|
|
1059
|
-
}
|
|
1060
|
-
case "usageLookback": {
|
|
1061
|
-
const window = windowOf(context, rule.notWithin, at, anchor);
|
|
1062
|
-
const reset = lastAtLeast(runsOf(log, rule.reset.statuses), rule.reset.consecutive);
|
|
1063
|
-
const from = reset !== undefined && reset.end > window.span.start
|
|
1064
|
-
? reset.end
|
|
1065
|
-
: window.span.start;
|
|
1066
|
-
// A use is an instant, and each window holds it once. An elapsed window runs up to and
|
|
1067
|
-
// including the use being made at `at`, so one exactly its length earlier is outside it; a
|
|
1068
|
-
// window of local periods holds only its own, so one on its end is the next's.
|
|
1069
|
-
const found = rule.uses.filter((use) => use >= from &&
|
|
1070
|
-
use <= at &&
|
|
1071
|
-
(rule.notWithin.kind === "elapsed"
|
|
1072
|
-
? use > at - rule.notWithin.length
|
|
1073
|
-
: use < window.span.end)).length;
|
|
1074
|
-
return capped(tally(found), tally(1), {
|
|
1075
|
-
window: { start: from, end: window.span.end },
|
|
1076
|
-
periodBasis: basisOf(window),
|
|
1077
|
-
dueBy: null,
|
|
1078
|
-
resetAt: reset?.end ?? null,
|
|
1079
|
-
grouping: groupingOf(window),
|
|
1080
|
-
});
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
622
|
+
if (rule.kind === "freePeriod") return evaluateFreePeriod(context, rule, at, anchor);
|
|
623
|
+
const { store } = context;
|
|
624
|
+
const first = logStartBefore(store, at) ?? at;
|
|
625
|
+
const viewOf = (test) => runsUntil(runIndex(store, test), at);
|
|
626
|
+
const timeOf = (test, from, to) => timeInBefore(runIndex(store, test), from, to, at);
|
|
627
|
+
switch (rule.kind) {
|
|
628
|
+
case "cumulativeCap": {
|
|
629
|
+
const reset = lastAtLeastUntil(viewOf(rule.since.statuses), rule.since.consecutive);
|
|
630
|
+
const from = reset?.end ?? first;
|
|
631
|
+
return capped(duration(timeOf(rule.statuses, from, at)), duration(rule.cap), {
|
|
632
|
+
window: {
|
|
633
|
+
start: from,
|
|
634
|
+
end: at
|
|
635
|
+
},
|
|
636
|
+
periodBasis: null,
|
|
637
|
+
dueBy: null,
|
|
638
|
+
resetAt: reset?.end ?? null,
|
|
639
|
+
grouping: "start"
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
case "elapsedWindow": {
|
|
643
|
+
const rests = viewOf(rule.since.statuses);
|
|
644
|
+
const after = lastAtLeastUntil(rests, rule.since.consecutive)?.end ?? null;
|
|
645
|
+
const opener = firstEntryIn(store, rule.startStatuses, after, at);
|
|
646
|
+
if (opener === void 0) return {
|
|
647
|
+
satisfied: true,
|
|
648
|
+
used: duration(0n),
|
|
649
|
+
limit: duration(rule.length),
|
|
650
|
+
remaining: duration(rule.length),
|
|
651
|
+
window: null,
|
|
652
|
+
periodBasis: null,
|
|
653
|
+
dueBy: null,
|
|
654
|
+
resetAt: after,
|
|
655
|
+
excess: 0n,
|
|
656
|
+
grouping: "start"
|
|
657
|
+
};
|
|
658
|
+
let opensAt = opener.start;
|
|
659
|
+
let second;
|
|
660
|
+
if (rule.exclude !== null) {
|
|
661
|
+
const latest = latestPairFrom(rests, firstStartingAtOrAfter(rests, opener.start), rule.since.consecutive, rule.exclude);
|
|
662
|
+
if (latest !== void 0) {
|
|
663
|
+
opensAt = latest.first.end;
|
|
664
|
+
second = latest.second;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
let closesAt = opensAt + rule.length;
|
|
668
|
+
let limit = rule.length;
|
|
669
|
+
let excluded = 0n;
|
|
670
|
+
let extended = false;
|
|
671
|
+
for (let pass = 0; pass < 2; pass++) {
|
|
672
|
+
if (excluded === 0n && second !== void 0 && second.start < closesAt) {
|
|
673
|
+
excluded = length(second);
|
|
674
|
+
closesAt += excluded;
|
|
675
|
+
}
|
|
676
|
+
if (!extended && rule.extension !== null && opener.start <= rule.extension.from && rule.extension.from < closesAt) {
|
|
677
|
+
extended = true;
|
|
678
|
+
closesAt += rule.extension.by;
|
|
679
|
+
limit += rule.extension.by;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
const late = timeOf(rule.restrictedStatuses, closesAt, at);
|
|
683
|
+
return {
|
|
684
|
+
satisfied: late === 0n,
|
|
685
|
+
used: duration(at - opensAt - excluded),
|
|
686
|
+
limit: duration(limit),
|
|
687
|
+
remaining: duration(closesAt - at),
|
|
688
|
+
window: {
|
|
689
|
+
start: opensAt,
|
|
690
|
+
end: closesAt
|
|
691
|
+
},
|
|
692
|
+
periodBasis: "elapsed",
|
|
693
|
+
dueBy: closesAt,
|
|
694
|
+
resetAt: after,
|
|
695
|
+
excess: late,
|
|
696
|
+
grouping: "start"
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
case "requiredInterruption": {
|
|
700
|
+
const breaks = viewOf({
|
|
701
|
+
not: rule.countedStatuses,
|
|
702
|
+
within: rule.outsideStatuses
|
|
703
|
+
});
|
|
704
|
+
const resetAt = interruptionResetAt(breaks, rule.minimum, rule.orderedSplit);
|
|
705
|
+
const from = resetAt ?? first;
|
|
706
|
+
return capped(duration(timeOf(rule.countedStatuses, from, at)), duration(rule.after), {
|
|
707
|
+
window: {
|
|
708
|
+
start: from,
|
|
709
|
+
end: at
|
|
710
|
+
},
|
|
711
|
+
periodBasis: null,
|
|
712
|
+
dueBy: null,
|
|
713
|
+
resetAt,
|
|
714
|
+
grouping: "start"
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
case "rollingCap": {
|
|
718
|
+
const window = windowOf(context, rule.window, at, anchor);
|
|
719
|
+
const reset = rule.reset === null ? void 0 : lastAtLeastUntil(viewOf(rule.reset.statuses), rule.reset.consecutive);
|
|
720
|
+
const from = reset !== void 0 && reset.end > window.span.start ? reset.end : window.span.start;
|
|
721
|
+
const to = min(window.span.end, at);
|
|
722
|
+
let used = timeOf(rule.statuses, from, to);
|
|
723
|
+
let limit = rule.cap;
|
|
724
|
+
if (rule.precondition !== null) {
|
|
725
|
+
const { restStatuses, minimum, beforeHours } = rule.precondition;
|
|
726
|
+
const rest = (from < to ? runsBetween(runIndex(store, restStatuses).runs, from, to) : []).find((run) => length(run) >= minimum);
|
|
727
|
+
const before = rest === void 0 ? used : timeOf(rule.statuses, from, rest.start);
|
|
728
|
+
if (rest === void 0 || before > beforeHours) {
|
|
729
|
+
limit = beforeHours;
|
|
730
|
+
used = before;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
return capped(duration(used), duration(limit), {
|
|
734
|
+
window: {
|
|
735
|
+
start: from,
|
|
736
|
+
end: window.span.end
|
|
737
|
+
},
|
|
738
|
+
periodBasis: basisOf(window),
|
|
739
|
+
dueBy: null,
|
|
740
|
+
resetAt: reset?.end ?? null,
|
|
741
|
+
grouping: groupingOf(window)
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
case "fixedPeriodCap": {
|
|
745
|
+
const window = windowOf(context, repeated(rule.period, rule.adjacent), at, anchor);
|
|
746
|
+
const total = timeOf(rule.statuses, window.span.start, min(window.span.end, at));
|
|
747
|
+
const rest = {
|
|
748
|
+
window: window.span,
|
|
749
|
+
periodBasis: basisOf(window),
|
|
750
|
+
dueBy: null,
|
|
751
|
+
resetAt: null,
|
|
752
|
+
grouping: groupingOf(window)
|
|
753
|
+
};
|
|
754
|
+
if (!rule.average) return capped(duration(total), duration(rule.cap), rest);
|
|
755
|
+
const periods = BigInt(rule.adjacent);
|
|
756
|
+
const allowed = rule.cap * periods;
|
|
757
|
+
return {
|
|
758
|
+
satisfied: total <= allowed,
|
|
759
|
+
used: duration((total + periods - 1n) / periods),
|
|
760
|
+
limit: duration(rule.cap),
|
|
761
|
+
remaining: duration(allowed - total),
|
|
762
|
+
excess: total - allowed,
|
|
763
|
+
...rest
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
case "restRequirement": return evaluateRestRequirement(context, rule, at, anchor);
|
|
767
|
+
case "restBeforeDuty": return evaluateRestBeforeDuty(context, rule, at);
|
|
768
|
+
case "quota": {
|
|
769
|
+
const continuing = entryHolding(store, at);
|
|
770
|
+
const running = continuing !== void 0 && rule.statuses.has(continuing.status);
|
|
771
|
+
const runs = viewOf(rule.statuses);
|
|
772
|
+
const sizes = {
|
|
773
|
+
minimum: rule.minimum,
|
|
774
|
+
maximum: rule.maximum
|
|
775
|
+
};
|
|
776
|
+
const skipEndingAt = running ? at : null;
|
|
777
|
+
if ("every" in rule.reset) {
|
|
778
|
+
const window = windowOf(context, rule.reset.every, at, anchor);
|
|
779
|
+
const to = min(window.span.end, at);
|
|
780
|
+
const found = countEvents(runs, sizes, {
|
|
781
|
+
from: window.span.start,
|
|
782
|
+
to
|
|
783
|
+
}, skipEndingAt);
|
|
784
|
+
return capped(tally(found), tally(rule.count), {
|
|
785
|
+
window: window.span,
|
|
786
|
+
periodBasis: basisOf(window),
|
|
787
|
+
dueBy: null,
|
|
788
|
+
resetAt: null,
|
|
789
|
+
grouping: groupingOf(window)
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
const reset = lastAtLeastUntil(viewOf(rule.reset.statuses), rule.reset.consecutive);
|
|
793
|
+
const from = reset?.end ?? first;
|
|
794
|
+
return capped(tally(countEvents(runs, sizes, {
|
|
795
|
+
from,
|
|
796
|
+
to: null
|
|
797
|
+
}, skipEndingAt)), tally(rule.count), {
|
|
798
|
+
window: {
|
|
799
|
+
start: from,
|
|
800
|
+
end: at
|
|
801
|
+
},
|
|
802
|
+
periodBasis: null,
|
|
803
|
+
dueBy: null,
|
|
804
|
+
resetAt: reset?.end ?? null,
|
|
805
|
+
grouping: "start"
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
case "dueBy": {
|
|
809
|
+
const events = viewOf(rule.statuses);
|
|
810
|
+
const event = lastAtLeastUntil(events, rule.minimum);
|
|
811
|
+
const reset = rule.reset === null ? void 0 : lastAtLeastUntil(viewOf(rule.reset.statuses), rule.reset.consecutive);
|
|
812
|
+
const clock = event === void 0 ? reset?.end ?? null : reset === void 0 ? event.end : max(event.end, reset.end);
|
|
813
|
+
const from = clock ?? first;
|
|
814
|
+
const due = boundaryAfter(context, rule.period, rule.periods, from);
|
|
815
|
+
const latest = events.last;
|
|
816
|
+
const pending = latest !== void 0 && latest.end === at && latest.start <= due;
|
|
817
|
+
return {
|
|
818
|
+
satisfied: at <= due || pending,
|
|
819
|
+
used: duration(at - from),
|
|
820
|
+
limit: duration(due - from),
|
|
821
|
+
remaining: duration(due - at),
|
|
822
|
+
window: {
|
|
823
|
+
start: from,
|
|
824
|
+
end: due
|
|
825
|
+
},
|
|
826
|
+
periodBasis: rule.period.kind === "elapsed" ? "elapsed" : scaleFor(context, rule.period.unit).basis,
|
|
827
|
+
dueBy: due,
|
|
828
|
+
resetAt: clock,
|
|
829
|
+
excess: at - due,
|
|
830
|
+
grouping: "start"
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
case "pattern": {
|
|
834
|
+
const window = windowOf(context, repeated(rule.period, rule.lookback), at, anchor);
|
|
835
|
+
const { span } = window;
|
|
836
|
+
const to = min(span.end, at);
|
|
837
|
+
const unfinished = span.end > at;
|
|
838
|
+
const counts = /* @__PURE__ */ new Map();
|
|
839
|
+
for (const named of rule.classes) {
|
|
840
|
+
const runs = viewOf(named.statuses);
|
|
841
|
+
const qualifies = (run) => run.start >= span.start && run.start < to && length(run) >= named.minimum;
|
|
842
|
+
const found = countEvents(runs, {
|
|
843
|
+
minimum: named.minimum,
|
|
844
|
+
maximum: null
|
|
845
|
+
}, {
|
|
846
|
+
from: span.start,
|
|
847
|
+
to
|
|
848
|
+
}, null);
|
|
849
|
+
const last = runs.last;
|
|
850
|
+
let best = found;
|
|
851
|
+
if (unfinished) {
|
|
852
|
+
let firstStart = at;
|
|
853
|
+
if (last !== void 0 && last.end === at && !qualifies(last) && last.start >= span.start) {
|
|
854
|
+
best += 1;
|
|
855
|
+
firstStart = last.start + named.minimum;
|
|
856
|
+
}
|
|
857
|
+
if (firstStart < span.end) {
|
|
858
|
+
const room = span.end - firstStart;
|
|
859
|
+
best += Number(min((room + named.minimum - 1n) / named.minimum, BigInt(Number.MAX_SAFE_INTEGER)));
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
counts.set(named.label, {
|
|
863
|
+
found,
|
|
864
|
+
best
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
const slack = rule.require.map((required) => {
|
|
868
|
+
const tallied = counts.get(required.label);
|
|
869
|
+
return {
|
|
870
|
+
...required,
|
|
871
|
+
found: tallied.found,
|
|
872
|
+
actual: tallied.found - required.atLeast,
|
|
873
|
+
best: tallied.best - required.atLeast
|
|
874
|
+
};
|
|
875
|
+
});
|
|
876
|
+
const tightest = slack.reduce((worst, item) => item.actual < worst.actual ? item : worst);
|
|
877
|
+
return {
|
|
878
|
+
satisfied: slack.every((item) => item.actual >= 0) || unfinished && slack.every((item) => item.best >= 0),
|
|
879
|
+
used: tally(tightest.found),
|
|
880
|
+
limit: tally(tightest.atLeast),
|
|
881
|
+
remaining: tally(-tightest.actual),
|
|
882
|
+
window: span,
|
|
883
|
+
periodBasis: basisOf(window),
|
|
884
|
+
dueBy: null,
|
|
885
|
+
resetAt: null,
|
|
886
|
+
excess: BigInt(-tightest.actual),
|
|
887
|
+
grouping: groupingOf(window)
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
case "occurrenceCap": {
|
|
891
|
+
const scale = scaleFor(context, rule.per.unit);
|
|
892
|
+
const runs = viewOf(rule.statuses);
|
|
893
|
+
const blocks = [];
|
|
894
|
+
let blockAnchor = anchor;
|
|
895
|
+
for (let index = 0; index < rule.lookback; index++) {
|
|
896
|
+
const block = periodsEndingAt(scale, rule.per.count, blockAnchor);
|
|
897
|
+
if (block === null) throw new Unrepresentable("period outside the instant range");
|
|
898
|
+
blocks.push(block);
|
|
899
|
+
blockAnchor = block.start - 1n;
|
|
900
|
+
}
|
|
901
|
+
const occupied = blocks.filter((block) => {
|
|
902
|
+
const to = min(block.end, at);
|
|
903
|
+
const position = rule.byInitiationDate ? firstStartingAtOrAfter(runs, block.start) : firstEndingAfter(runs, block.start);
|
|
904
|
+
return position < runs.count && viewRun(runs, position).start < to;
|
|
905
|
+
}).length;
|
|
906
|
+
const earliest = blocks[blocks.length - 1];
|
|
907
|
+
const latest = blocks[0];
|
|
908
|
+
return capped(tally(occupied), tally(rule.maximum), {
|
|
909
|
+
window: {
|
|
910
|
+
start: earliest.start,
|
|
911
|
+
end: latest.end
|
|
912
|
+
},
|
|
913
|
+
periodBasis: scale.basis,
|
|
914
|
+
dueBy: null,
|
|
915
|
+
resetAt: null,
|
|
916
|
+
grouping: rule.lookback * rule.per.count > 1 ? "slide" : "period"
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
case "usageLookback": {
|
|
920
|
+
const window = windowOf(context, rule.notWithin, at, anchor);
|
|
921
|
+
const reset = lastAtLeastUntil(viewOf(rule.reset.statuses), rule.reset.consecutive);
|
|
922
|
+
const from = reset !== void 0 && reset.end > window.span.start ? reset.end : window.span.start;
|
|
923
|
+
const found = countInRange(rule.uses, rule.notWithin.kind === "elapsed" ? max(from, at - rule.notWithin.length + 1n) : from, rule.notWithin.kind === "elapsed" ? at + 1n : min(at + 1n, window.span.end));
|
|
924
|
+
return capped(tally(found), tally(1), {
|
|
925
|
+
window: {
|
|
926
|
+
start: from,
|
|
927
|
+
end: window.span.end
|
|
928
|
+
},
|
|
929
|
+
periodBasis: basisOf(window),
|
|
930
|
+
dueBy: null,
|
|
931
|
+
resetAt: reset?.end ?? null,
|
|
932
|
+
grouping: groupingOf(window)
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
}
|
|
1083
936
|
}
|
|
1084
937
|
const instantText = (nanoseconds) => Temporal.Instant.fromEpochNanoseconds(nanoseconds).toString();
|
|
1085
938
|
function measureText(measure) {
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
}
|
|
1092
|
-
const text = formatHourDuration(measure.duration);
|
|
1093
|
-
// A requirement `orFactor` scales can pass the longest duration Temporal holds.
|
|
1094
|
-
if (text === "") {
|
|
1095
|
-
throw new Unrepresentable("a duration past Temporal's range");
|
|
1096
|
-
}
|
|
1097
|
-
return text;
|
|
939
|
+
if (measure === null) return null;
|
|
940
|
+
if (!("duration" in measure)) return measure.count;
|
|
941
|
+
const text = formatHourDuration(measure.duration);
|
|
942
|
+
if (text === "") throw new Unrepresentable("a duration past Temporal's range");
|
|
943
|
+
return text;
|
|
1098
944
|
}
|
|
1099
945
|
function spanText(span) {
|
|
1100
|
-
|
|
946
|
+
return {
|
|
947
|
+
start: instantText(span.start),
|
|
948
|
+
end: instantText(span.end)
|
|
949
|
+
};
|
|
1101
950
|
}
|
|
1102
951
|
/**
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
};
|
|
1128
|
-
});
|
|
952
|
+
* Evaluate every rule at one instant.
|
|
953
|
+
*
|
|
954
|
+
* @param context the call's context
|
|
955
|
+
* @param rules the resolved rules
|
|
956
|
+
* @param at the instant, epoch nanoseconds
|
|
957
|
+
* @returns one outcome per rule, in order
|
|
958
|
+
*/
|
|
959
|
+
function evaluateDutyRules(context, rules, at) {
|
|
960
|
+
return rules.map((rule) => {
|
|
961
|
+
const evaluation = evaluateRule(context, rule, at, at - 1n);
|
|
962
|
+
return {
|
|
963
|
+
label: rule.label,
|
|
964
|
+
kind: rule.kind,
|
|
965
|
+
severity: rule.severity,
|
|
966
|
+
satisfied: evaluation.satisfied,
|
|
967
|
+
used: measureText(evaluation.used),
|
|
968
|
+
limit: measureText(evaluation.limit),
|
|
969
|
+
remaining: measureText(evaluation.remaining),
|
|
970
|
+
window: evaluation.window === null ? null : spanText(evaluation.window),
|
|
971
|
+
periodBasis: evaluation.periodBasis,
|
|
972
|
+
dueBy: evaluation.dueBy === null ? null : instantText(evaluation.dueBy),
|
|
973
|
+
resetAt: evaluation.resetAt === null ? null : instantText(evaluation.resetAt)
|
|
974
|
+
};
|
|
975
|
+
});
|
|
1129
976
|
}
|
|
1130
977
|
/** The elapsed lengths a rule's window slides by, for the candidate instants of a range. */
|
|
1131
978
|
function slideLengths(rule) {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
periods.push(rule.notWithin);
|
|
1153
|
-
break;
|
|
1154
|
-
default:
|
|
1155
|
-
break;
|
|
1156
|
-
}
|
|
1157
|
-
return periods.flatMap((period) => period.kind === "elapsed" ? [period.length] : []);
|
|
979
|
+
const periods = [];
|
|
980
|
+
switch (rule.kind) {
|
|
981
|
+
case "rollingCap":
|
|
982
|
+
periods.push(rule.window);
|
|
983
|
+
break;
|
|
984
|
+
case "restRequirement":
|
|
985
|
+
periods.push(rule.per);
|
|
986
|
+
break;
|
|
987
|
+
case "freePeriod":
|
|
988
|
+
periods.push(rule.within);
|
|
989
|
+
break;
|
|
990
|
+
case "quota":
|
|
991
|
+
if ("every" in rule.reset) periods.push(rule.reset.every);
|
|
992
|
+
break;
|
|
993
|
+
case "pattern":
|
|
994
|
+
periods.push(repeated(rule.period, rule.lookback));
|
|
995
|
+
break;
|
|
996
|
+
case "usageLookback": periods.push(rule.notWithin);
|
|
997
|
+
}
|
|
998
|
+
return periods.flatMap((period) => period.kind === "elapsed" ? [period.length] : []);
|
|
1158
999
|
}
|
|
1159
1000
|
/** The local units a rule counts in, whose boundaries are candidate instants of a range. */
|
|
1160
1001
|
function unitsOf(rule) {
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
periods.push(rule.notWithin);
|
|
1189
|
-
break;
|
|
1190
|
-
default:
|
|
1191
|
-
break;
|
|
1192
|
-
}
|
|
1193
|
-
return periods.flatMap((period) => period.kind === "units" ? [period.unit] : []);
|
|
1002
|
+
const periods = [];
|
|
1003
|
+
switch (rule.kind) {
|
|
1004
|
+
case "rollingCap":
|
|
1005
|
+
periods.push(rule.window);
|
|
1006
|
+
break;
|
|
1007
|
+
case "fixedPeriodCap":
|
|
1008
|
+
periods.push(rule.period);
|
|
1009
|
+
break;
|
|
1010
|
+
case "restRequirement":
|
|
1011
|
+
periods.push(rule.per);
|
|
1012
|
+
break;
|
|
1013
|
+
case "freePeriod":
|
|
1014
|
+
periods.push(rule.within);
|
|
1015
|
+
break;
|
|
1016
|
+
case "quota":
|
|
1017
|
+
if ("every" in rule.reset) periods.push(rule.reset.every);
|
|
1018
|
+
break;
|
|
1019
|
+
case "dueBy":
|
|
1020
|
+
case "pattern":
|
|
1021
|
+
periods.push(rule.period);
|
|
1022
|
+
break;
|
|
1023
|
+
case "occurrenceCap":
|
|
1024
|
+
periods.push(rule.per);
|
|
1025
|
+
break;
|
|
1026
|
+
case "usageLookback": periods.push(rule.notWithin);
|
|
1027
|
+
}
|
|
1028
|
+
return periods.flatMap((period) => period.kind === "units" ? [period.unit] : []);
|
|
1194
1029
|
}
|
|
1195
1030
|
const NANOSECONDS_PER_DAY = 86400000000000n;
|
|
1196
1031
|
/**
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1032
|
+
* More than any one local period of a unit can last: its longest calendar length plus a week. A
|
|
1033
|
+
* clock change moves the wall clock by less than 48 hours, since Temporal holds every offset
|
|
1034
|
+
* strictly within ±24 hours, so neither a skipped date nor a repeated stretch can add a week.
|
|
1035
|
+
*/
|
|
1201
1036
|
const LONGER_THAN_ANY = {
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1037
|
+
operatorDay: 8n * NANOSECONDS_PER_DAY,
|
|
1038
|
+
day: 8n * NANOSECONDS_PER_DAY,
|
|
1039
|
+
week: 14n * NANOSECONDS_PER_DAY,
|
|
1040
|
+
month: 38n * NANOSECONDS_PER_DAY,
|
|
1041
|
+
year: 373n * NANOSECONDS_PER_DAY
|
|
1207
1042
|
};
|
|
1208
1043
|
/**
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
throw new Unrepresentable("too many periods in the range");
|
|
1228
|
-
}
|
|
1229
|
-
visit(current.end);
|
|
1230
|
-
current = scale.containing(current.end);
|
|
1231
|
-
}
|
|
1232
|
-
if (current === null) {
|
|
1233
|
-
throw new Unrepresentable("period outside the instant range");
|
|
1234
|
-
}
|
|
1044
|
+
* Call `visit` with the end of every period of `scale` that ends inside `(from, until]`, starting
|
|
1045
|
+
* with the one `from` falls in.
|
|
1046
|
+
*
|
|
1047
|
+
* - Throws `Unrepresentable` when more than `MAX_PERIOD_COUNT` periods end there, or for a period
|
|
1048
|
+
* Temporal cannot hold.
|
|
1049
|
+
* - A span of `MAX_PERIOD_COUNT + 1` times `LONGER_THAN_ANY` or more certainly holds more ends
|
|
1050
|
+
* than that, so it is refused without a lookup. A shorter span is walked, and the walk decides.
|
|
1051
|
+
*/
|
|
1052
|
+
function walkBoundaries(scale, unit, from, until, visit) {
|
|
1053
|
+
if (from >= until) return;
|
|
1054
|
+
if (until - from >= BigInt(1e4 + 1) * LONGER_THAN_ANY[unit]) throw new Unrepresentable("too many periods in the range");
|
|
1055
|
+
let current = scale.containing(from);
|
|
1056
|
+
for (let step = 0; current !== null && current.end <= until; step++) {
|
|
1057
|
+
if (step >= 1e4) throw new Unrepresentable("too many periods in the range");
|
|
1058
|
+
visit(current.end);
|
|
1059
|
+
current = scale.containing(current.end);
|
|
1060
|
+
}
|
|
1061
|
+
if (current === null) throw new Unrepresentable("period outside the instant range");
|
|
1235
1062
|
}
|
|
1236
1063
|
/**
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1064
|
+
* The runs whose lengths a rule compares with floors, and the floors: where a run reaches a floor
|
|
1065
|
+
* (`start + floor`), or, inside a sliding window, shrinks below it (`end + length − floor`), the
|
|
1066
|
+
* rule's answer can change between entry bounds.
|
|
1067
|
+
*/
|
|
1241
1068
|
function runFloors(rule) {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
// Multiples are added per run in `candidateInstants`: a run holds floor(length / minimum).
|
|
1311
|
-
return [];
|
|
1312
|
-
case "quota":
|
|
1313
|
-
return "every" in rule.reset
|
|
1314
|
-
? []
|
|
1315
|
-
: [
|
|
1316
|
-
{
|
|
1317
|
-
test: rule.reset.statuses,
|
|
1318
|
-
floors: [rule.reset.consecutive],
|
|
1319
|
-
sliding: false,
|
|
1320
|
-
},
|
|
1321
|
-
];
|
|
1322
|
-
case "dueBy":
|
|
1323
|
-
return [
|
|
1324
|
-
{ test: rule.statuses, floors: [rule.minimum], sliding: false },
|
|
1325
|
-
...(rule.reset === null
|
|
1326
|
-
? []
|
|
1327
|
-
: [
|
|
1328
|
-
{
|
|
1329
|
-
test: rule.reset.statuses,
|
|
1330
|
-
floors: [rule.reset.consecutive],
|
|
1331
|
-
sliding: false,
|
|
1332
|
-
},
|
|
1333
|
-
]),
|
|
1334
|
-
];
|
|
1335
|
-
case "pattern":
|
|
1336
|
-
return rule.classes.map((named) => ({
|
|
1337
|
-
test: named.statuses,
|
|
1338
|
-
floors: [named.minimum],
|
|
1339
|
-
sliding: false,
|
|
1340
|
-
}));
|
|
1341
|
-
case "usageLookback":
|
|
1342
|
-
return [
|
|
1343
|
-
{
|
|
1344
|
-
test: rule.reset.statuses,
|
|
1345
|
-
floors: [rule.reset.consecutive],
|
|
1346
|
-
sliding: false,
|
|
1347
|
-
},
|
|
1348
|
-
];
|
|
1349
|
-
default:
|
|
1350
|
-
return [];
|
|
1351
|
-
}
|
|
1069
|
+
switch (rule.kind) {
|
|
1070
|
+
case "cumulativeCap": return [{
|
|
1071
|
+
test: rule.since.statuses,
|
|
1072
|
+
floors: [rule.since.consecutive],
|
|
1073
|
+
sliding: false
|
|
1074
|
+
}];
|
|
1075
|
+
case "elapsedWindow": return [{
|
|
1076
|
+
test: rule.since.statuses,
|
|
1077
|
+
floors: [rule.since.consecutive, ...rule.exclude === null ? [] : [rule.exclude.each, rule.exclude.one]],
|
|
1078
|
+
sliding: false
|
|
1079
|
+
}];
|
|
1080
|
+
case "requiredInterruption": return [{
|
|
1081
|
+
test: {
|
|
1082
|
+
not: rule.countedStatuses,
|
|
1083
|
+
within: rule.outsideStatuses
|
|
1084
|
+
},
|
|
1085
|
+
floors: [rule.minimum, ...rule.orderedSplit ?? []],
|
|
1086
|
+
sliding: false
|
|
1087
|
+
}];
|
|
1088
|
+
case "rollingCap": return [...rule.reset === null ? [] : [{
|
|
1089
|
+
test: rule.reset.statuses,
|
|
1090
|
+
floors: [rule.reset.consecutive],
|
|
1091
|
+
sliding: false
|
|
1092
|
+
}], ...rule.precondition === null ? [] : [{
|
|
1093
|
+
test: rule.precondition.restStatuses,
|
|
1094
|
+
floors: [rule.precondition.minimum],
|
|
1095
|
+
sliding: true
|
|
1096
|
+
}]];
|
|
1097
|
+
case "restRequirement": {
|
|
1098
|
+
const floors = [rule.minimum];
|
|
1099
|
+
if (rule.composition !== null) {
|
|
1100
|
+
floors.push(rule.composition.longestAtLeast);
|
|
1101
|
+
if (rule.composition.othersAtLeast > 0n) floors.push(rule.composition.othersAtLeast);
|
|
1102
|
+
}
|
|
1103
|
+
if (rule.composite !== null) floors.push(rule.composite.consecutive, rule.composite.blockMinimum, rule.composite.consecutive + rule.composite.additional);
|
|
1104
|
+
return [{
|
|
1105
|
+
test: rule.restStatuses,
|
|
1106
|
+
floors,
|
|
1107
|
+
sliding: true
|
|
1108
|
+
}];
|
|
1109
|
+
}
|
|
1110
|
+
case "freePeriod": return [];
|
|
1111
|
+
case "quota": return "every" in rule.reset ? [] : [{
|
|
1112
|
+
test: rule.reset.statuses,
|
|
1113
|
+
floors: [rule.reset.consecutive],
|
|
1114
|
+
sliding: false
|
|
1115
|
+
}];
|
|
1116
|
+
case "dueBy": return [{
|
|
1117
|
+
test: rule.statuses,
|
|
1118
|
+
floors: [rule.minimum],
|
|
1119
|
+
sliding: false
|
|
1120
|
+
}, ...rule.reset === null ? [] : [{
|
|
1121
|
+
test: rule.reset.statuses,
|
|
1122
|
+
floors: [rule.reset.consecutive],
|
|
1123
|
+
sliding: false
|
|
1124
|
+
}]];
|
|
1125
|
+
case "pattern": return rule.classes.map((named) => ({
|
|
1126
|
+
test: named.statuses,
|
|
1127
|
+
floors: [named.minimum],
|
|
1128
|
+
sliding: false
|
|
1129
|
+
}));
|
|
1130
|
+
case "usageLookback": return [{
|
|
1131
|
+
test: rule.reset.statuses,
|
|
1132
|
+
floors: [rule.reset.consecutive],
|
|
1133
|
+
sliding: false
|
|
1134
|
+
}];
|
|
1135
|
+
default: return [];
|
|
1136
|
+
}
|
|
1352
1137
|
}
|
|
1353
1138
|
/**
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1139
|
+
* The instants at which a rule's answer can change, inside `(start, end]`.
|
|
1140
|
+
*
|
|
1141
|
+
* A rule's measures are piecewise linear in the instant evaluated, so a failed window shows at a
|
|
1142
|
+
* breakpoint or just either side of one:
|
|
1143
|
+
*
|
|
1144
|
+
* - every entry bound and use, those bounds shifted by the rule's sliding lengths, and every
|
|
1145
|
+
* boundary of its local periods;
|
|
1146
|
+
* - where a run reaches or, in a sliding window, shrinks past a floor the rule compares it with;
|
|
1147
|
+
* - for a rest rule that picks its longest runs, where two runs cross as the longest;
|
|
1148
|
+
* - where a gap passes `maxGap`, a rest falls due, and a free period gains or loses a local window;
|
|
1149
|
+
* - the first instant after `start`, so a window failing as the range opens is seen.
|
|
1150
|
+
*/
|
|
1366
1151
|
function candidateInstants(context, rule, range) {
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
// A rest shrinking out of the window crosses one growing at its end, or one held whole.
|
|
1461
|
-
for (let other = 0; other < near.length; other++) {
|
|
1462
|
-
const later = near[other];
|
|
1463
|
-
if (later.start - earlier.end >= 2n * shift ||
|
|
1464
|
-
earlier.start - later.end >= 2n * shift) {
|
|
1465
|
-
continue;
|
|
1466
|
-
}
|
|
1467
|
-
const crossing = (earlier.end + shift + later.start) / 2n;
|
|
1468
|
-
around(crossing);
|
|
1469
|
-
around(crossing + 1n);
|
|
1470
|
-
around(earlier.end + shift - length(later));
|
|
1471
|
-
around(later.start + length(earlier));
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
if (rule.kind === "freePeriod") {
|
|
1477
|
-
const minimum = rule.minimum;
|
|
1478
|
-
// A run's points lie at most `atLeast + 1` free periods and a window length past its end, so
|
|
1479
|
-
// a run further than that before the range, or after it, adds none inside it.
|
|
1480
|
-
const farthest = (BigInt(rule.atLeast) + 1n) * minimum +
|
|
1481
|
-
shifts.reduce((longest, shift) => max(longest, shift), 0n);
|
|
1482
|
-
const rests = runsOf(context.entries, rule.restStatuses).filter((run) => run.end + farthest >= range.start && run.start <= until + 1n);
|
|
1483
|
-
// A window fails only while it holds fewer than `atLeast` free periods, so a run's count
|
|
1484
|
-
// changing above `atLeast` changes no answer: each run's first `atLeast + 1` multiples are
|
|
1485
|
-
// the ones that matter. Of those, only the ones that land in the range are taken.
|
|
1486
|
-
const reach = BigInt(rule.atLeast) + 1n;
|
|
1487
|
-
const multiplesFrom = (origin, last) => {
|
|
1488
|
-
const first = max(0n, floorDivide(range.start - origin, minimum) - 1n);
|
|
1489
|
-
const final = min(last, floorDivide(until - origin, minimum) + 1n);
|
|
1490
|
-
for (let multiple = first; multiple <= final; multiple++) {
|
|
1491
|
-
around(origin + multiple * minimum);
|
|
1492
|
-
}
|
|
1493
|
-
};
|
|
1494
|
-
const multiplesBefore = (origin, last) => {
|
|
1495
|
-
const first = max(0n, floorDivide(origin - until, minimum) - 1n);
|
|
1496
|
-
const final = min(last, floorDivide(origin - range.start, minimum) + 1n);
|
|
1497
|
-
for (let multiple = first; multiple <= final; multiple++) {
|
|
1498
|
-
around(origin - multiple * minimum);
|
|
1499
|
-
}
|
|
1500
|
-
};
|
|
1501
|
-
for (const run of rests) {
|
|
1502
|
-
const multiples = min(length(run) / minimum + 1n, reach);
|
|
1503
|
-
multiplesFrom(run.start, multiples);
|
|
1504
|
-
for (const shift of shifts) {
|
|
1505
|
-
multiplesBefore(run.end + shift, multiples);
|
|
1506
|
-
}
|
|
1507
|
-
if (rule.containing !== null) {
|
|
1508
|
-
const windows = localWindowsIn(context, rule.containing.window, run.start, run.end, false);
|
|
1509
|
-
for (const window of windows) {
|
|
1510
|
-
multiplesFrom(window.end, multiples);
|
|
1511
|
-
for (const shift of shifts) {
|
|
1512
|
-
around(window.start + shift);
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
if (rule.kind === "dueBy") {
|
|
1519
|
-
// A rest falls due the instant after its deadline; each run long enough to start the clock,
|
|
1520
|
-
// and the log's start, set one.
|
|
1521
|
-
const clocks = [
|
|
1522
|
-
context.entries[0]?.start,
|
|
1523
|
-
...runsOf(context.entries, rule.statuses)
|
|
1524
|
-
.filter((run) => length(run) >= rule.minimum)
|
|
1525
|
-
.map((run) => run.end),
|
|
1526
|
-
...(rule.reset === null
|
|
1527
|
-
? []
|
|
1528
|
-
: runsOf(context.entries, rule.reset.statuses)
|
|
1529
|
-
.filter((run) => length(run) >=
|
|
1530
|
-
rule.reset.consecutive)
|
|
1531
|
-
.map((run) => run.end)),
|
|
1532
|
-
];
|
|
1533
|
-
for (const clock of clocks) {
|
|
1534
|
-
if (clock !== undefined) {
|
|
1535
|
-
around(boundaryAfter(context, rule.period, rule.periods, clock));
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
// Before the log's first entry and the first use, no rule has anything to fail on, so the
|
|
1540
|
-
// period boundaries walked are the ones from there to `until`, however long `range` is.
|
|
1541
|
-
const from = max(range.start, firstEvidence(context, rule));
|
|
1542
|
-
for (const unit of unitsOf(rule)) {
|
|
1543
|
-
walkBoundaries(scaleFor(context, unit), unit, from, until, around);
|
|
1544
|
-
}
|
|
1545
|
-
return [...points]
|
|
1546
|
-
.filter((point) => point > range.start && point <= until)
|
|
1547
|
-
.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
|
|
1152
|
+
const logEnd = context.entries[context.entries.length - 1]?.end;
|
|
1153
|
+
if (logEnd === void 0) return [];
|
|
1154
|
+
const until = min(range.end, logEnd);
|
|
1155
|
+
const base = [];
|
|
1156
|
+
for (const entry of context.entries) base.push(entry.start, entry.end);
|
|
1157
|
+
if (rule.kind === "usageLookback") base.push(...rule.uses);
|
|
1158
|
+
if (rule.kind === "elapsedWindow" && rule.extension !== null) base.push(rule.extension.from);
|
|
1159
|
+
const points = /* @__PURE__ */ new Set([range.start + 1n, until]);
|
|
1160
|
+
const add = (point) => {
|
|
1161
|
+
if (point > range.start && point <= until) points.add(point);
|
|
1162
|
+
};
|
|
1163
|
+
const around = (point) => {
|
|
1164
|
+
add(point - 1n);
|
|
1165
|
+
add(point);
|
|
1166
|
+
add(point + 1n);
|
|
1167
|
+
if (points.size > MAX_CANDIDATE_INSTANTS) throw new Unrepresentable("too many instants to check");
|
|
1168
|
+
};
|
|
1169
|
+
for (const point of base) around(point);
|
|
1170
|
+
const shifts = slideLengths(rule);
|
|
1171
|
+
for (const shift of shifts) for (const point of base) around(point + shift);
|
|
1172
|
+
for (const { test, floors, sliding } of runFloors(rule)) for (const run of runIndex(context.store, test).runs) for (const floor of floors) {
|
|
1173
|
+
around(run.start + floor);
|
|
1174
|
+
if (sliding) for (const shift of shifts) around(run.end + shift - floor);
|
|
1175
|
+
}
|
|
1176
|
+
if (rule.kind === "elapsedWindow" && rule.exclude !== null) {
|
|
1177
|
+
const fullRest = rule.since.consecutive;
|
|
1178
|
+
let partner;
|
|
1179
|
+
for (const run of runIndex(context.store, rule.since.statuses).runs) {
|
|
1180
|
+
if (partner !== void 0) around(run.start + rule.exclude.combined - length(partner));
|
|
1181
|
+
const taken = length(run);
|
|
1182
|
+
if (taken >= fullRest) partner = void 0;
|
|
1183
|
+
else if (taken >= rule.exclude.each) partner = run;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
if (rule.kind === "restRequirement") {
|
|
1187
|
+
const rests = runIndex(context.store, rule.restStatuses).runs;
|
|
1188
|
+
const ranks = rule.composition !== null || rule.composite !== null;
|
|
1189
|
+
if (rule.maxGap !== null) for (const start of [...rests.map((run) => run.end), ...context.entries.slice(0, 1).map((entry) => entry.start)]) around(start + rule.maxGap);
|
|
1190
|
+
for (const shift of ranks ? shifts : []) {
|
|
1191
|
+
const near = rests.filter((run) => run.end >= range.start - 2n * shift && run.start <= until + 2n * shift);
|
|
1192
|
+
for (let index = 0; index < near.length; index++) {
|
|
1193
|
+
const earlier = near[index];
|
|
1194
|
+
for (let other = firstWhere(near.length, (position) => near[position].end > earlier.start - 2n * shift); other < near.length; other++) {
|
|
1195
|
+
const later = near[other];
|
|
1196
|
+
if (later.start - earlier.end >= 2n * shift) break;
|
|
1197
|
+
const crossing = (earlier.end + shift + later.start) / 2n;
|
|
1198
|
+
around(crossing);
|
|
1199
|
+
around(crossing + 1n);
|
|
1200
|
+
around(earlier.end + shift - length(later));
|
|
1201
|
+
around(later.start + length(earlier));
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
if (rule.kind === "freePeriod") {
|
|
1207
|
+
const minimum = rule.minimum;
|
|
1208
|
+
const farthest = (BigInt(rule.atLeast) + 1n) * minimum + shifts.reduce((longest, shift) => max(longest, shift), 0n);
|
|
1209
|
+
const rests = runIndex(context.store, rule.restStatuses).runs.filter((run) => run.end + farthest >= range.start && run.start <= until + 1n);
|
|
1210
|
+
const reach = BigInt(rule.atLeast) + 1n;
|
|
1211
|
+
const multiplesFrom = (origin, last) => {
|
|
1212
|
+
const first = max(0n, floorDivide(range.start - origin, minimum) - 1n);
|
|
1213
|
+
const final = min(last, floorDivide(until - origin, minimum) + 1n);
|
|
1214
|
+
for (let multiple = first; multiple <= final; multiple++) around(origin + multiple * minimum);
|
|
1215
|
+
};
|
|
1216
|
+
const multiplesBefore = (origin, last) => {
|
|
1217
|
+
const first = max(0n, floorDivide(origin - until, minimum) - 1n);
|
|
1218
|
+
const final = min(last, floorDivide(origin - range.start, minimum) + 1n);
|
|
1219
|
+
for (let multiple = first; multiple <= final; multiple++) around(origin - multiple * minimum);
|
|
1220
|
+
};
|
|
1221
|
+
for (const run of rests) {
|
|
1222
|
+
const multiples = min(length(run) / minimum + 1n, reach);
|
|
1223
|
+
multiplesFrom(run.start, multiples);
|
|
1224
|
+
for (const shift of shifts) multiplesBefore(run.end + shift, multiples);
|
|
1225
|
+
if (rule.containing !== null) {
|
|
1226
|
+
const windows = localWindowsIn(context, rule.containing.window, run.start, run.end, false);
|
|
1227
|
+
for (const window of windows) {
|
|
1228
|
+
multiplesFrom(window.end, multiples);
|
|
1229
|
+
for (const shift of shifts) around(window.start + shift);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
if (rule.kind === "dueBy") {
|
|
1235
|
+
const clocks = [
|
|
1236
|
+
context.entries[0]?.start,
|
|
1237
|
+
...runIndex(context.store, rule.statuses).runs.filter((run) => length(run) >= rule.minimum).map((run) => run.end),
|
|
1238
|
+
...rule.reset === null ? [] : runIndex(context.store, rule.reset.statuses).runs.filter((run) => length(run) >= rule.reset.consecutive).map((run) => run.end)
|
|
1239
|
+
];
|
|
1240
|
+
for (const clock of clocks) if (clock !== void 0) around(boundaryAfter(context, rule.period, rule.periods, clock));
|
|
1241
|
+
}
|
|
1242
|
+
const from = max(range.start, firstEvidence(context, rule));
|
|
1243
|
+
for (const unit of unitsOf(rule)) walkBoundaries(scaleFor(context, unit), unit, from, until, around);
|
|
1244
|
+
return [...points].filter((point) => point > range.start && point <= until).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
1548
1245
|
}
|
|
1549
1246
|
/** `a / b` rounded down, for a positive `b`: bigint division rounds towards zero. */
|
|
1550
1247
|
function floorDivide(a, b) {
|
|
1551
|
-
|
|
1248
|
+
return a >= 0n ? a / b : -((-a + b - 1n) / b);
|
|
1552
1249
|
}
|
|
1553
1250
|
/**
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1251
|
+
* The worse of two failures, `a` the earlier: the larger excess, and on a tie the earlier, whose
|
|
1252
|
+
* window is the first to show it (a cap's window ends when the time over it was worked, not after
|
|
1253
|
+
* the rest that followed).
|
|
1254
|
+
*/
|
|
1558
1255
|
function worse(a, b) {
|
|
1559
|
-
|
|
1256
|
+
return b.evaluation.excess > a.evaluation.excess ? b : a;
|
|
1560
1257
|
}
|
|
1561
1258
|
const keyOf = (evaluation) => evaluation.key ?? evaluation.window.start;
|
|
1562
1259
|
/** Whether a failure continues a violation: no passing check between, or the same key. */
|
|
1563
1260
|
function continues(violation, failure) {
|
|
1564
|
-
|
|
1565
|
-
? violation.open
|
|
1566
|
-
: keyOf(failure.evaluation) === violation.key;
|
|
1261
|
+
return violation.grouping === "slide" ? violation.open : keyOf(failure.evaluation) === violation.key;
|
|
1567
1262
|
}
|
|
1568
1263
|
/** A violation's report after one more failure: the last check of a period, else the worst. */
|
|
1569
1264
|
function report(violation, failure) {
|
|
1570
|
-
|
|
1571
|
-
? failure
|
|
1572
|
-
: worse(violation.worst, failure);
|
|
1265
|
+
return violation.grouping === "period" ? failure : worse(violation.worst, failure);
|
|
1573
1266
|
}
|
|
1574
1267
|
/** The kinds that hold rest to a floor, which the record does not judge before the log starts. */
|
|
1575
|
-
const FLOOR_KINDS = new Set([
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1268
|
+
const FLOOR_KINDS = /* @__PURE__ */ new Set([
|
|
1269
|
+
"restRequirement",
|
|
1270
|
+
"freePeriod",
|
|
1271
|
+
"pattern",
|
|
1272
|
+
"restBeforeDuty"
|
|
1580
1273
|
]);
|
|
1581
1274
|
/**
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
const MAX_CANDIDATE_INSTANTS =
|
|
1275
|
+
* The most instants one rule may be checked at in one range. A log of a year has a few tens of
|
|
1276
|
+
* thousands; more than this is refused rather than checked one by one.
|
|
1277
|
+
*/
|
|
1278
|
+
const MAX_CANDIDATE_INSTANTS = 1e6;
|
|
1586
1279
|
/** Thirty days: how far past a range's end the scan reads at a time, so a period walk stays short. */
|
|
1587
1280
|
const FORWARD_CHUNK = 2592000000000000n;
|
|
1588
1281
|
/**
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1282
|
+
* The earliest instant a rule has anything to fail on: the log's first entry, or for
|
|
1283
|
+
* `usageLookback` its first use when that is earlier. Undefined for an empty log.
|
|
1284
|
+
*/
|
|
1592
1285
|
function firstEvidence(context, rule) {
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
? undefined
|
|
1596
|
-
: [first, ...(rule.kind === "usageLookback" ? rule.uses : [])].reduce(min);
|
|
1286
|
+
const first = context.entries[0]?.start;
|
|
1287
|
+
return first === void 0 ? void 0 : [first, ...rule.kind === "usageLookback" ? rule.uses : []].reduce(min);
|
|
1597
1288
|
}
|
|
1598
1289
|
/**
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1290
|
+
* The violations of one rule, each listed in the range it began in and reported by its worst
|
|
1291
|
+
* window, which may end after the range.
|
|
1292
|
+
*
|
|
1293
|
+
* - Failures inside `range` are grouped into violations as `scanDutyViolations` describes.
|
|
1294
|
+
* - The first is dropped when it was already failing at `range.start`: it belongs to the range
|
|
1295
|
+
* before. So two adjacent ranges list every violation once.
|
|
1296
|
+
* - The last is followed past `range.end` to its worst window, up to the log's last entry, never
|
|
1297
|
+
* into time the log does not cover.
|
|
1298
|
+
*/
|
|
1608
1299
|
function ruleViolations(context, rule, asked) {
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
const until = min(cursor + FORWARD_CHUNK, logEnd);
|
|
1688
|
-
for (const at of candidateInstants(context, rule, {
|
|
1689
|
-
start: cursor,
|
|
1690
|
-
end: until,
|
|
1691
|
-
})) {
|
|
1692
|
-
const { evaluation, failure } = check(at);
|
|
1693
|
-
if (last.grouping === "slide") {
|
|
1694
|
-
if (failure === null) {
|
|
1695
|
-
going = false;
|
|
1696
|
-
break;
|
|
1697
|
-
}
|
|
1698
|
-
last.worst = report(last, failure);
|
|
1699
|
-
}
|
|
1700
|
-
else if (evaluation.window === null ||
|
|
1701
|
-
keyOf(evaluation) !== last.key) {
|
|
1702
|
-
going = false;
|
|
1703
|
-
break;
|
|
1704
|
-
}
|
|
1705
|
-
else if (failure !== null) {
|
|
1706
|
-
last.worst = report(last, failure);
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
cursor = until;
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
return violations.map((violation) => violation.worst);
|
|
1300
|
+
const evidence = firstEvidence(context, rule);
|
|
1301
|
+
if (evidence === void 0) return [];
|
|
1302
|
+
const range = {
|
|
1303
|
+
start: max(asked.start, evidence - 1n),
|
|
1304
|
+
end: asked.end
|
|
1305
|
+
};
|
|
1306
|
+
const logStart = context.entries[0]?.start;
|
|
1307
|
+
const judgesRest = FLOOR_KINDS.has(rule.kind);
|
|
1308
|
+
const check = (at) => {
|
|
1309
|
+
const evaluation = evaluateRule(context, rule, at, at - 1n);
|
|
1310
|
+
return {
|
|
1311
|
+
evaluation,
|
|
1312
|
+
failure: evaluation.window !== null && !(judgesRest && logStart !== void 0 && (evaluation.window.start < logStart || evaluation.beforeLog === true)) && !evaluation.satisfied ? {
|
|
1313
|
+
evaluation,
|
|
1314
|
+
at
|
|
1315
|
+
} : null
|
|
1316
|
+
};
|
|
1317
|
+
};
|
|
1318
|
+
const violations = [];
|
|
1319
|
+
const candidates = candidateInstants(context, rule, range);
|
|
1320
|
+
let firstChecked;
|
|
1321
|
+
for (const at of candidates) {
|
|
1322
|
+
const { failure } = check(at);
|
|
1323
|
+
const last = violations[violations.length - 1];
|
|
1324
|
+
if (firstChecked === void 0) firstChecked = failure;
|
|
1325
|
+
if (failure === null) {
|
|
1326
|
+
if (last !== void 0) last.open = false;
|
|
1327
|
+
} else if (last !== void 0 && continues(last, failure)) last.worst = report(last, failure);
|
|
1328
|
+
else violations.push({
|
|
1329
|
+
worst: failure,
|
|
1330
|
+
grouping: failure.evaluation.grouping,
|
|
1331
|
+
key: keyOf(failure.evaluation),
|
|
1332
|
+
open: true
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
const first = violations[0];
|
|
1336
|
+
if (first !== void 0) {
|
|
1337
|
+
let before;
|
|
1338
|
+
if (first.grouping === "slide") before = firstChecked !== void 0 && firstChecked !== null && check(range.start).failure !== null;
|
|
1339
|
+
else {
|
|
1340
|
+
const key = first.key;
|
|
1341
|
+
before = key < range.start && candidateInstants(context, rule, {
|
|
1342
|
+
start: key,
|
|
1343
|
+
end: range.start
|
|
1344
|
+
}).some((at) => {
|
|
1345
|
+
const { failure } = check(at);
|
|
1346
|
+
return failure !== null && continues(first, failure);
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
if (before) violations.shift();
|
|
1350
|
+
}
|
|
1351
|
+
const last = violations[violations.length - 1];
|
|
1352
|
+
const logEnd = context.entries[context.entries.length - 1]?.end;
|
|
1353
|
+
if (last !== void 0 && logEnd !== void 0 && logEnd > range.end && (last.grouping !== "slide" || last.open)) {
|
|
1354
|
+
let cursor = range.end;
|
|
1355
|
+
let going = true;
|
|
1356
|
+
for (let chunk = 0; going && cursor < logEnd && chunk <= 1e4; chunk++) {
|
|
1357
|
+
const until = min(cursor + FORWARD_CHUNK, logEnd);
|
|
1358
|
+
for (const at of candidateInstants(context, rule, {
|
|
1359
|
+
start: cursor,
|
|
1360
|
+
end: until
|
|
1361
|
+
})) {
|
|
1362
|
+
const { evaluation, failure } = check(at);
|
|
1363
|
+
if (last.grouping === "slide") {
|
|
1364
|
+
if (failure === null) {
|
|
1365
|
+
going = false;
|
|
1366
|
+
break;
|
|
1367
|
+
}
|
|
1368
|
+
last.worst = report(last, failure);
|
|
1369
|
+
} else if (evaluation.window === null || keyOf(evaluation) !== last.key) {
|
|
1370
|
+
going = false;
|
|
1371
|
+
break;
|
|
1372
|
+
} else if (failure !== null) last.worst = report(last, failure);
|
|
1373
|
+
}
|
|
1374
|
+
cursor = until;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
return violations.map((violation) => violation.worst);
|
|
1713
1378
|
}
|
|
1714
1379
|
/**
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
limit: measureText(failure.evaluation.limit),
|
|
1745
|
-
}));
|
|
1380
|
+
* Every violation of the rules whose severity is `"violation"` inside a range. A moving window's
|
|
1381
|
+
* failures are one violation while no check passes between them; a count since a reset, or one
|
|
1382
|
+
* fixed period, is one violation however often it is checked. Each is reported by its worst
|
|
1383
|
+
* window and listed in the range it began in.
|
|
1384
|
+
*
|
|
1385
|
+
* @param context the call's context
|
|
1386
|
+
* @param rules the resolved rules
|
|
1387
|
+
* @param range the range, epoch nanoseconds
|
|
1388
|
+
* @returns the violations, ordered by window start and then by rule
|
|
1389
|
+
*/
|
|
1390
|
+
function scanDutyViolations(context, rules, range) {
|
|
1391
|
+
const found = [];
|
|
1392
|
+
rules.forEach((rule, order) => {
|
|
1393
|
+
if (rule.severity === "violation") for (const failure of ruleViolations(context, rule, range)) found.push({
|
|
1394
|
+
order,
|
|
1395
|
+
label: rule.label,
|
|
1396
|
+
failure
|
|
1397
|
+
});
|
|
1398
|
+
});
|
|
1399
|
+
return found.sort((a, b) => {
|
|
1400
|
+
const aStart = a.failure.evaluation.window.start;
|
|
1401
|
+
const bStart = b.failure.evaluation.window.start;
|
|
1402
|
+
return aStart < bStart ? -1 : aStart > bStart ? 1 : a.order - b.order;
|
|
1403
|
+
}).map(({ label, failure }) => ({
|
|
1404
|
+
label,
|
|
1405
|
+
window: spanText(failure.evaluation.window),
|
|
1406
|
+
used: measureText(failure.evaluation.used),
|
|
1407
|
+
limit: measureText(failure.evaluation.limit)
|
|
1408
|
+
}));
|
|
1746
1409
|
}
|
|
1410
|
+
|
|
1411
|
+
export { Unrepresentable, clipRuns, evaluateDutyRules, prepareDutyCall, readStatusList, restPairs, runsOf, scanDutyViolations, timeIn, walkBoundaries };
|