@northguild/gmt 1.21.0 → 1.22.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 +3 -3
- package/dist/aviation/format/formatSsimDate.d.ts +35 -0
- package/dist/aviation/format/formatSsimDate.js +55 -0
- package/dist/aviation/format/index.d.ts +2 -0
- package/dist/aviation/format/index.js +3 -0
- package/dist/aviation/index.d.ts +9 -0
- package/dist/aviation/index.js +10 -0
- package/dist/aviation/parse/index.d.ts +4 -0
- package/dist/aviation/parse/index.js +5 -0
- package/dist/aviation/parse/parseMetarTime.d.ts +33 -0
- package/dist/aviation/parse/parseMetarTime.js +40 -0
- package/dist/aviation/parse/parseNotamValidity.d.ts +39 -0
- package/dist/aviation/parse/parseNotamValidity.js +44 -0
- package/dist/aviation/parse/parseSsimDate.d.ts +35 -0
- package/dist/aviation/parse/parseSsimDate.js +41 -0
- package/dist/aviation/validate/index.d.ts +4 -0
- package/dist/aviation/validate/index.js +5 -0
- package/dist/aviation/validate/isValidMetarTime.d.ts +21 -0
- package/dist/aviation/validate/isValidMetarTime.js +28 -0
- package/dist/aviation/validate/isValidNotamValidity.d.ts +26 -0
- package/dist/aviation/validate/isValidNotamValidity.js +32 -0
- package/dist/aviation/validate/isValidSsimDate.d.ts +23 -0
- package/dist/aviation/validate/isValidSsimDate.js +29 -0
- package/dist/calendar/business/businessDaysBetween.js +7 -5
- package/dist/calendar/calculate/bucketRange.js +10 -7
- package/dist/calendar/calculate/floorToZone.d.ts +2 -5
- package/dist/calendar/calculate/floorToZone.js +8 -11
- package/dist/calendar/calculate/getFiscalPeriod.js +3 -3
- package/dist/calendar/calculate/getQuarter.js +3 -3
- package/dist/calendar/index.js +8 -8
- package/dist/calendar/validate/index.js +1 -1
- package/dist/calendar/validate/isValidFiscalCalendar.js +2 -12
- package/dist/calendar/validate/isValidFiscalExtraWeek.js +3 -2
- package/dist/calendar/validate/isValidFiscalPattern.js +3 -2
- package/dist/calendar/validate/isValidFiscalYearLabel.js +3 -2
- package/dist/calendar/validate/isValidZoneBucketUnit.js +2 -4
- package/dist/duration/calculate/absDuration.js +4 -4
- package/dist/duration/calculate/addDuration.js +6 -4
- package/dist/duration/calculate/durationFromUnits.js +2 -2
- package/dist/duration/calculate/getDurationSign.js +4 -4
- package/dist/duration/calculate/getDurationUnit.js +5 -5
- package/dist/duration/calculate/negateDuration.js +4 -4
- package/dist/duration/calculate/subtractDuration.js +6 -4
- package/dist/duration/calculate/totalDuration.d.ts +10 -11
- package/dist/duration/calculate/totalDuration.js +15 -16
- package/dist/duration/calculate/totalUnits.js +2 -2
- package/dist/duration/calculate/totalUnitsFromNow.js +3 -3
- package/dist/duration/calculate/ttlFromNow.js +2 -2
- package/dist/duration/compare/compareDurations.d.ts +10 -11
- package/dist/duration/compare/compareDurations.js +16 -14
- package/dist/duration/format/formatDuration.js +6 -6
- package/dist/duration/format/formatHumanDuration.js +2 -2
- package/dist/duration/index.js +1 -1
- package/dist/duration/normalize/normalizeDuration.d.ts +10 -11
- package/dist/duration/normalize/normalizeDuration.js +15 -18
- package/dist/duration/parse/parseDuration.js +6 -5
- package/dist/duration/validate/isValidDuration.js +2 -2
- package/dist/finance/format/formatFixUtcTimestamp.d.ts +43 -0
- package/dist/finance/format/formatFixUtcTimestamp.js +60 -0
- package/dist/finance/format/formatSwiftDate.d.ts +30 -0
- package/dist/finance/format/formatSwiftDate.js +46 -0
- package/dist/finance/format/index.d.ts +3 -0
- package/dist/finance/format/index.js +4 -0
- package/dist/finance/index.d.ts +8 -0
- package/dist/finance/index.js +9 -0
- package/dist/finance/parse/index.d.ts +3 -0
- package/dist/finance/parse/index.js +4 -0
- package/dist/finance/parse/parseFixUtcTimestamp.d.ts +50 -0
- package/dist/finance/parse/parseFixUtcTimestamp.js +56 -0
- package/dist/finance/parse/parseSwiftDate.d.ts +34 -0
- package/dist/finance/parse/parseSwiftDate.js +41 -0
- package/dist/finance/validate/index.d.ts +3 -0
- package/dist/finance/validate/index.js +4 -0
- package/dist/finance/validate/isValidFixUtcTimestamp.d.ts +26 -0
- package/dist/finance/validate/isValidFixUtcTimestamp.js +8 -0
- package/dist/finance/validate/isValidSwiftDate.d.ts +21 -0
- package/dist/finance/validate/isValidSwiftDate.js +28 -0
- package/dist/gnss/convert/gnssToUtc.d.ts +2 -2
- package/dist/gnss/convert/gnssToUtc.js +2 -2
- package/dist/gnss/convert/gnssWeekToUtc.d.ts +3 -2
- package/dist/gnss/convert/gnssWeekToUtc.js +3 -2
- package/dist/healthcare/format/formatFHIR.d.ts +54 -0
- package/dist/healthcare/format/formatFHIR.js +152 -0
- package/dist/healthcare/format/formatHL7.d.ts +62 -0
- package/dist/healthcare/format/formatHL7.js +187 -0
- package/dist/healthcare/format/index.d.ts +3 -0
- package/dist/healthcare/format/index.js +4 -0
- package/dist/healthcare/index.d.ts +11 -0
- package/dist/healthcare/index.js +9 -0
- package/dist/healthcare/parse/index.d.ts +3 -0
- package/dist/healthcare/parse/index.js +4 -0
- package/dist/healthcare/parse/parseFHIR.d.ts +37 -0
- package/dist/healthcare/parse/parseFHIR.js +46 -0
- package/dist/healthcare/parse/parseHL7.d.ts +58 -0
- package/dist/healthcare/parse/parseHL7.js +63 -0
- package/dist/healthcare/validate/index.d.ts +3 -0
- package/dist/healthcare/validate/index.js +4 -0
- package/dist/healthcare/validate/isValidFHIR.d.ts +36 -0
- package/dist/healthcare/validate/isValidFHIR.js +13 -0
- package/dist/healthcare/validate/isValidHL7.d.ts +35 -0
- package/dist/healthcare/validate/isValidHL7.js +42 -0
- package/dist/index.d.ts +61 -3
- package/dist/index.js +165 -119
- package/dist/instant/convert/classifyLocal.d.ts +2 -3
- package/dist/instant/convert/classifyLocal.js +7 -9
- package/dist/instant/convert/fromOffsetInstant.js +2 -27
- package/dist/instant/convert/index.js +1 -1
- package/dist/instant/convert/resolveLocal.d.ts +4 -4
- package/dist/instant/convert/resolveLocal.js +7 -24
- package/dist/instant/convert/toOffsetInstant.d.ts +5 -6
- package/dist/instant/convert/toOffsetInstant.js +7 -55
- package/dist/instant/index.d.ts +1 -1
- package/dist/instant/index.js +1 -1
- package/dist/intermodal/calculate/billingTimeline.js +11 -10
- package/dist/intermodal/calculate/chargeableDays.js +8 -6
- package/dist/intermodal/calculate/demurrageClock.d.ts +2 -2
- package/dist/intermodal/calculate/demurrageClock.js +18 -9
- package/dist/intermodal/calculate/freeTimeExpiry.js +5 -5
- package/dist/intermodal/calculate/multimodalETA.d.ts +3 -0
- package/dist/intermodal/calculate/multimodalETA.js +5 -2
- package/dist/intermodal/format/bolTimestamp.d.ts +4 -6
- package/dist/intermodal/format/bolTimestamp.js +8 -10
- package/dist/intermodal/format/formatEdifactOffsetDateTime.d.ts +3 -2
- package/dist/intermodal/format/formatEdifactOffsetDateTime.js +3 -2
- package/dist/intermodal/format/formatEpcisEvent.js +1 -1
- package/dist/intermodal/index.js +3 -3
- package/dist/intermodal/parse/classifyX12TimeCode.js +2 -11
- package/dist/intermodal/parse/index.js +2 -2
- package/dist/intermodal/parse/parseEdifactDate.js +2 -6
- package/dist/intermodal/parse/parseEdifactDatePeriod.js +2 -6
- package/dist/intermodal/parse/parseEdifactDateTime.js +2 -6
- package/dist/intermodal/parse/parseEdifactDateTimePeriod.js +2 -6
- package/dist/intermodal/parse/parseEdifactOffsetDateTime.d.ts +3 -1
- package/dist/intermodal/parse/parseEdifactOffsetDateTime.js +5 -7
- package/dist/intermodal/parse/parseEdifactTime.js +2 -6
- package/dist/intermodal/parse/parseX12Date.js +2 -6
- package/dist/intermodal/parse/parseX12DateAndTime.d.ts +3 -1
- package/dist/intermodal/parse/parseX12DateAndTime.js +5 -7
- package/dist/intermodal/parse/parseX12DateRange.js +2 -6
- package/dist/intermodal/parse/parseX12DateTime.js +2 -6
- package/dist/intermodal/parse/parseX12DateTimeRange.js +2 -6
- package/dist/intermodal/parse/parseX12Time.js +2 -6
- package/dist/intermodal/parse/x12TimeCodeOffset.js +3 -43
- package/dist/intermodal/parse/x12TimeCodeZone.js +3 -114
- package/dist/intermodal/validate/index.js +1 -1
- package/dist/intermodal/validate/isValidEdifactDate.d.ts +1 -1
- package/dist/intermodal/validate/isValidEdifactDate.js +3 -3
- package/dist/intermodal/validate/isValidEdifactDatePeriod.d.ts +1 -1
- package/dist/intermodal/validate/isValidEdifactDatePeriod.js +3 -3
- package/dist/intermodal/validate/isValidEdifactDateTime.d.ts +1 -1
- package/dist/intermodal/validate/isValidEdifactDateTime.js +3 -3
- package/dist/intermodal/validate/isValidEdifactDateTimePeriod.d.ts +1 -1
- package/dist/intermodal/validate/isValidEdifactDateTimePeriod.js +3 -3
- package/dist/intermodal/validate/isValidEdifactOffsetDateTime.d.ts +1 -1
- package/dist/intermodal/validate/isValidEdifactOffsetDateTime.js +3 -3
- package/dist/intermodal/validate/isValidEdifactTime.d.ts +1 -1
- package/dist/intermodal/validate/isValidEdifactTime.js +3 -3
- package/dist/intermodal/validate/isValidEpcisEvent.js +2 -3
- package/dist/intermodal/validate/isValidEpcisEventTime.js +2 -9
- package/dist/intermodal/validate/isValidEpcisTimeZoneOffset.js +2 -3
- package/dist/intermodal/validate/isValidX12Date.d.ts +1 -1
- package/dist/intermodal/validate/isValidX12Date.js +3 -3
- package/dist/intermodal/validate/isValidX12DateAndTime.d.ts +1 -1
- package/dist/intermodal/validate/isValidX12DateAndTime.js +3 -3
- package/dist/intermodal/validate/isValidX12DateRange.d.ts +1 -1
- package/dist/intermodal/validate/isValidX12DateRange.js +3 -3
- package/dist/intermodal/validate/isValidX12DateTime.d.ts +1 -1
- package/dist/intermodal/validate/isValidX12DateTime.js +3 -3
- package/dist/intermodal/validate/isValidX12DateTimeRange.d.ts +1 -1
- package/dist/intermodal/validate/isValidX12DateTimeRange.js +3 -3
- package/dist/intermodal/validate/isValidX12Time.d.ts +1 -1
- package/dist/intermodal/validate/isValidX12Time.js +3 -3
- package/dist/internal/adjustZonedBusinessDays.d.ts +2 -1
- package/dist/internal/adjustZonedBusinessDays.js +2 -4
- package/dist/internal/businessCalendar.d.ts +1 -1
- package/dist/internal/businessCalendar.js +5 -5
- package/dist/internal/businessDayValues.js +8 -8
- package/dist/internal/calendarDatePairPolicy.d.ts +1 -1
- package/dist/internal/calendarDateString.d.ts +25 -14
- package/dist/internal/calendarDateString.js +34 -19
- package/dist/internal/calendarZonedPairPolicy.d.ts +1 -1
- package/dist/internal/calendarZonedString.d.ts +23 -14
- package/dist/internal/calendarZonedString.js +35 -18
- package/dist/internal/ccsdsAsciiTime.d.ts +91 -0
- package/dist/internal/ccsdsAsciiTime.js +145 -0
- package/dist/internal/compareToToday.d.ts +10 -0
- package/dist/internal/compareToToday.js +23 -0
- package/dist/internal/copticEra.d.ts +12 -0
- package/dist/internal/copticEra.js +189 -0
- package/dist/internal/cutoffAtResolved.js +1 -1
- package/dist/internal/daylightTime.d.ts +3 -1
- package/dist/internal/daylightTime.js +3 -1
- package/dist/internal/deliverySchedule.d.ts +24 -0
- package/dist/internal/deliverySchedule.js +249 -0
- package/dist/internal/durationFrom.d.ts +19 -0
- package/dist/internal/durationFrom.js +26 -0
- package/dist/internal/durationUntilString.js +5 -8
- package/dist/internal/dutyLog.js +1 -1
- package/dist/internal/dutyPeriods.d.ts +1 -1
- package/dist/internal/dutyPeriods.js +4 -5
- package/dist/internal/dutyRules.js +3 -3
- package/dist/internal/ediDateTimeFields.d.ts +75 -2
- package/dist/internal/ediDateTimeFields.js +149 -6
- package/dist/internal/ediDateTimeWriter.d.ts +3 -3
- package/dist/internal/ediDateTimeWriter.js +30 -23
- package/dist/internal/epcisTime.d.ts +22 -0
- package/dist/internal/epcisTime.js +39 -0
- package/dist/internal/exactDuration.js +2 -2
- package/dist/internal/exactMoment.d.ts +25 -3
- package/dist/internal/exactMoment.js +46 -25
- package/dist/internal/fhirDateTime.d.ts +22 -0
- package/dist/internal/fhirDateTime.js +97 -0
- package/dist/internal/fixUtcTimestamp.d.ts +95 -0
- package/dist/internal/fixUtcTimestamp.js +180 -0
- package/dist/internal/formatDateInCalendar.d.ts +1 -1
- package/dist/internal/formatRelativeDuration.js +3 -3
- package/dist/internal/formatterCache.d.ts +12 -0
- package/dist/internal/formatterCache.js +74 -26
- package/dist/internal/freeTimeLedger.d.ts +2 -1
- package/dist/internal/freeTimeLedger.js +7 -6
- package/dist/internal/gnssTimeScales.d.ts +1 -1
- package/dist/internal/gnssWeek.js +2 -2
- package/dist/internal/gtfsServiceDate.d.ts +9 -0
- package/dist/internal/gtfsServiceDate.js +26 -0
- package/dist/internal/gtfsTime.d.ts +34 -0
- package/dist/internal/gtfsTime.js +63 -0
- package/dist/internal/halfOpenIntervals.d.ts +1 -1
- package/dist/internal/hl7DateTime.d.ts +137 -0
- package/dist/internal/hl7DateTime.js +293 -0
- package/dist/internal/holidayRules.js +2 -2
- package/dist/internal/httpDateFields.d.ts +13 -1
- package/dist/internal/httpDateFields.js +45 -1
- package/dist/internal/identifierText.d.ts +1 -1
- package/dist/internal/identifierText.js +1 -1
- package/dist/internal/index.d.ts +21 -5
- package/dist/internal/index.js +26 -10
- package/dist/internal/inputChecks.d.ts +87 -16
- package/dist/internal/inputChecks.js +134 -45
- package/dist/internal/instantFormatOptions.js +2 -2
- package/dist/internal/instantNanoseconds.d.ts +36 -57
- package/dist/internal/instantNanoseconds.js +47 -142
- package/dist/internal/instantStringFromEpochNanoseconds.d.ts +21 -1
- package/dist/internal/instantStringFromEpochNanoseconds.js +39 -1
- package/dist/internal/intervalChecks.d.ts +69 -0
- package/dist/internal/intervalChecks.js +128 -0
- package/dist/internal/intervalNanoseconds.d.ts +66 -1
- package/dist/internal/intervalNanoseconds.js +139 -2
- package/dist/internal/isObject.d.ts +16 -1
- package/dist/internal/isObject.js +21 -2
- package/dist/internal/islamicEpochEra.d.ts +24 -0
- package/dist/internal/islamicEpochEra.js +199 -0
- package/dist/internal/isoStringBody.d.ts +84 -21
- package/dist/internal/isoStringBody.js +146 -45
- package/dist/internal/japaneseNumerals.d.ts +17 -0
- package/dist/internal/japaneseNumerals.js +51 -0
- package/dist/internal/julianDate.d.ts +147 -0
- package/dist/internal/julianDate.js +280 -0
- package/dist/internal/leapSeconds.d.ts +13 -1
- package/dist/internal/leapSeconds.js +18 -2
- package/dist/internal/localResolution.js +2 -2
- package/dist/internal/localeMonthNames.js +2 -2
- package/dist/internal/localeNames.d.ts +5 -0
- package/dist/internal/localeNames.js +90 -0
- package/dist/internal/metarTime.d.ts +16 -0
- package/dist/internal/metarTime.js +85 -0
- package/dist/internal/normalizeTimeZone.d.ts +1 -1
- package/dist/internal/normalizeTimeZone.js +5 -5
- package/dist/internal/notamDateTime.d.ts +25 -0
- package/dist/internal/notamDateTime.js +59 -0
- package/dist/internal/offsetInstant.d.ts +58 -0
- package/dist/internal/offsetInstant.js +168 -0
- package/dist/internal/operatingSchedule.js +15 -14
- package/dist/internal/patternKey.d.ts +11 -0
- package/dist/internal/patternKey.js +38 -0
- package/dist/internal/patternToken.d.ts +7 -5
- package/dist/internal/patternToken.js +21 -18
- package/dist/internal/plainDateAdd.js +2 -2
- package/dist/internal/plainDateSteps.d.ts +64 -0
- package/dist/internal/plainDateSteps.js +134 -0
- package/dist/internal/plainDateUntil.js +2 -3
- package/dist/internal/plainFormatOptions.d.ts +2 -1
- package/dist/internal/plainFormatOptions.js +2 -1
- package/dist/internal/plainOptionEntries.d.ts +16 -0
- package/dist/internal/plainOptionEntries.js +33 -0
- package/dist/internal/protoRecord.d.ts +21 -0
- package/dist/internal/protoRecord.js +40 -14
- package/dist/internal/ptpTimestamp.d.ts +33 -0
- package/dist/internal/ptpTimestamp.js +48 -0
- package/dist/internal/rangeDetector.d.ts +31 -0
- package/dist/internal/rangeDetector.js +512 -0
- package/dist/internal/rangeFallback.d.ts +34 -0
- package/dist/internal/rangeFallback.js +111 -0
- package/dist/internal/rangeFieldValues.d.ts +39 -0
- package/dist/internal/rangeFieldValues.js +167 -0
- package/dist/internal/rangeFields.d.ts +34 -0
- package/dist/internal/rangeFields.js +130 -0
- package/dist/internal/rangeHooks.d.ts +53 -0
- package/dist/internal/rangeHooks.js +26 -0
- package/dist/internal/rangeRepairs.d.ts +4 -0
- package/dist/internal/rangeRepairs.js +16 -0
- package/dist/internal/readDateTimeFormatOptions.d.ts +7 -9
- package/dist/internal/readDateTimeFormatOptions.js +19 -24
- package/dist/internal/readSetFields.d.ts +47 -0
- package/dist/internal/readSetFields.js +58 -1
- package/dist/internal/repairRangeText.d.ts +26 -0
- package/dist/internal/repairRangeText.js +69 -0
- package/dist/internal/resolveDateTimeUnit.js +3 -3
- package/dist/internal/resolveDurationRelativeTo.d.ts +20 -11
- package/dist/internal/resolveDurationRelativeTo.js +21 -20
- package/dist/internal/resolveDurationUnit.d.ts +35 -1
- package/dist/internal/resolveDurationUnit.js +49 -4
- package/dist/internal/resolveLocalInstant.d.ts +14 -0
- package/dist/internal/resolveLocalInstant.js +40 -0
- package/dist/internal/resolveLocale.d.ts +26 -1
- package/dist/internal/resolveLocale.js +44 -3
- package/dist/internal/resolveOverflow.d.ts +1 -0
- package/dist/internal/resolveOverflow.js +2 -0
- package/dist/internal/resolveUnixIntervalPair.js +2 -2
- package/dist/internal/rfc3339DateTime.d.ts +11 -0
- package/dist/internal/rfc3339DateTime.js +29 -0
- package/dist/internal/rfc5322DateTime.d.ts +12 -1
- package/dist/internal/rfc5322DateTime.js +31 -1
- package/dist/internal/setZonedFields.d.ts +24 -0
- package/dist/internal/setZonedFields.js +26 -0
- package/dist/internal/ssimDate.d.ts +25 -0
- package/dist/internal/ssimDate.js +70 -0
- package/dist/internal/startOrEndOfUnix.js +1 -1
- package/dist/internal/startOrEndOfUtc.js +7 -6
- package/dist/internal/startOrEndOfZoned.js +7 -7
- package/dist/internal/swiftDate.d.ts +28 -0
- package/dist/internal/swiftDate.js +60 -0
- package/dist/internal/tai64Label.d.ts +28 -0
- package/dist/internal/tai64Label.js +63 -0
- package/dist/internal/temporalCompat/capabilities.d.ts +90 -10
- package/dist/internal/temporalCompat/capabilities.js +202 -12
- package/dist/internal/temporalCompat/fieldSearch.js +1 -1
- package/dist/internal/temporalCompat/index.d.ts +2 -3
- package/dist/internal/temporalCompat/index.js +3 -4
- package/dist/internal/temporalCompat/islamicEra.js +13 -6
- package/dist/internal/temporalCompat/probeRepros.d.ts +1 -2
- package/dist/internal/temporalCompat/probeRepros.js +115 -117
- package/dist/internal/temporalCompat/rangeFieldRepros.d.ts +50 -0
- package/dist/internal/temporalCompat/rangeFieldRepros.js +427 -0
- package/dist/internal/temporalCompat/repros.d.ts +18 -2
- package/dist/internal/temporalCompat/repros.js +325 -1
- package/dist/internal/terrestrialTime.d.ts +54 -0
- package/dist/internal/terrestrialTime.js +67 -0
- package/dist/internal/timeScaleString.d.ts +4 -4
- package/dist/internal/timeScaleString.js +2 -2
- package/dist/internal/timestampEvents.d.ts +3 -4
- package/dist/internal/timestampEvents.js +4 -5
- package/dist/internal/todayDate.d.ts +9 -0
- package/dist/internal/todayDate.js +22 -0
- package/dist/internal/typedOptions.d.ts +160 -0
- package/dist/internal/typedOptions.js +231 -0
- package/dist/internal/unitNames.d.ts +159 -0
- package/dist/internal/unitNames.js +227 -0
- package/dist/internal/unixFormatReference.js +2 -8
- package/dist/internal/unixWallClock.d.ts +18 -1
- package/dist/internal/unixWallClock.js +44 -1
- package/dist/internal/utcInstant.d.ts +16 -0
- package/dist/internal/utcInstant.js +30 -0
- package/dist/internal/utcReading.d.ts +2 -0
- package/dist/internal/utcReading.js +7 -6
- package/dist/internal/utcWallClock.js +4 -4
- package/dist/internal/weekNumber.d.ts +20 -0
- package/dist/internal/weekNumber.js +33 -0
- package/dist/internal/weekYearGuard.d.ts +15 -0
- package/dist/internal/weekYearGuard.js +201 -0
- package/dist/internal/weekYearRange.d.ts +47 -0
- package/dist/internal/weekYearRange.js +901 -0
- package/dist/internal/weekYearSynth.d.ts +13 -0
- package/dist/internal/weekYearSynth.js +352 -0
- package/dist/internal/weekYearText.d.ts +120 -0
- package/dist/internal/weekYearText.js +293 -0
- package/dist/internal/x12TimeCodes.d.ts +31 -0
- package/dist/internal/x12TimeCodes.js +198 -0
- package/dist/internal/yearPrinting.d.ts +29 -0
- package/dist/internal/yearPrinting.js +239 -0
- package/dist/internal/yearPrintingRange.d.ts +13 -0
- package/dist/internal/yearPrintingRange.js +198 -0
- package/dist/internal/yearWindowStart.d.ts +29 -1
- package/dist/internal/yearWindowStart.js +33 -2
- package/dist/internal/zoneFrame.js +5 -5
- package/dist/internal/zonedBucket.js +1 -1
- package/dist/internal/zonedDifference/calendarArithmetic.d.ts +3 -4
- package/dist/internal/zonedDifference/calendarArithmetic.js +3 -2
- package/dist/internal/zonedDifference/nudgeWindow.d.ts +2 -3
- package/dist/internal/zonedDifference/nudgeWindow.js +1 -1
- package/dist/internal/zonedDifference/operations.d.ts +2 -3
- package/dist/internal/zonedFormatReference.js +3 -3
- package/dist/internal/zonedWallClock.d.ts +26 -0
- package/dist/internal/zonedWallClock.js +50 -6
- package/dist/internal/zonedWallClockDifference.d.ts +3 -4
- package/dist/internal/zonedWallClockDifference.js +3 -4
- package/dist/internal/zonedWallClockOperations.js +7 -6
- package/dist/internal/zonelessCalendarDate.d.ts +1 -1
- package/dist/internal/zonelessCalendarDate.js +3 -3
- package/dist/interval/calculate/clampInterval.js +2 -2
- package/dist/interval/calculate/index.js +1 -1
- package/dist/interval/calculate/intersectIntervals.js +2 -13
- package/dist/interval/calculate/mergeIntervals.js +2 -11
- package/dist/interval/calculate/subtractIntervals.js +2 -26
- package/dist/interval/compare/intervalContains.d.ts +3 -4
- package/dist/interval/compare/intervalContains.js +5 -14
- package/dist/interval/compare/intervalsOverlap.js +2 -9
- package/dist/interval/index.js +1 -1
- package/dist/interval/validate/isValidInterval.d.ts +4 -8
- package/dist/interval/validate/isValidInterval.js +4 -8
- package/dist/iot/convert/index.d.ts +3 -0
- package/dist/iot/convert/index.js +4 -0
- package/dist/iot/convert/ptpToUtc.d.ts +42 -0
- package/dist/iot/convert/ptpToUtc.js +51 -0
- package/dist/iot/convert/utcToPtp.d.ts +31 -0
- package/dist/iot/convert/utcToPtp.js +47 -0
- package/dist/iot/index.d.ts +5 -0
- package/dist/iot/index.js +6 -0
- package/dist/iot/validate/index.d.ts +2 -0
- package/dist/iot/validate/index.js +3 -0
- package/dist/iot/validate/isValidPtpTimestamp.d.ts +33 -0
- package/dist/iot/validate/isValidPtpTimestamp.js +36 -0
- package/dist/plain/calculate/addDate.js +6 -8
- package/dist/plain/calculate/addDateTime.js +6 -7
- package/dist/plain/calculate/addTime.js +6 -7
- package/dist/plain/calculate/clampDate.js +5 -5
- package/dist/plain/calculate/closestDateTo.js +12 -8
- package/dist/plain/calculate/cycleDate.js +10 -9
- package/dist/plain/calculate/cycleDateTime.js +11 -11
- package/dist/plain/calculate/cycleTime.js +9 -9
- package/dist/plain/calculate/diffDate.js +7 -8
- package/dist/plain/calculate/diffDateAsDuration.js +5 -5
- package/dist/plain/calculate/diffDateTime.js +10 -14
- package/dist/plain/calculate/diffDateTimeAsDuration.js +6 -8
- package/dist/plain/calculate/diffTime.js +10 -13
- package/dist/plain/calculate/endOfDate.js +3 -4
- package/dist/plain/calculate/endOfDateTime.js +5 -5
- package/dist/plain/calculate/endOfQuarterForDate.js +3 -4
- package/dist/plain/calculate/endOfQuarterForDateTime.js +3 -4
- package/dist/plain/calculate/endOfTime.js +5 -5
- package/dist/plain/calculate/getDayOfYear.js +4 -4
- package/dist/plain/calculate/getDaysInMonth.js +4 -4
- package/dist/plain/calculate/getDaysInYear.js +4 -4
- package/dist/plain/calculate/getLargestDateDurationUnit.js +2 -16
- package/dist/plain/calculate/getLargestDateTimeDurationUnit.js +2 -22
- package/dist/plain/calculate/getLargestTimeDurationUnit.js +2 -18
- package/dist/plain/calculate/getLocaleDayOfWeek.js +4 -4
- package/dist/plain/calculate/getLocaleEndOfWeek.js +3 -4
- package/dist/plain/calculate/getLocaleStartOfWeek.js +5 -6
- package/dist/plain/calculate/getLocaleWeekYear.js +3 -4
- package/dist/plain/calculate/getQuarterForDate.js +3 -4
- package/dist/plain/calculate/getQuarterForDateTime.js +3 -4
- package/dist/plain/calculate/getWeekNumber.js +5 -13
- package/dist/plain/calculate/getWeekOfMonth.js +3 -4
- package/dist/plain/calculate/getWeekYear.js +4 -4
- package/dist/plain/calculate/getWeeksInLocaleWeekYear.js +3 -4
- package/dist/plain/calculate/getWeeksInMonth.js +3 -4
- package/dist/plain/calculate/getWeeksInYear.js +4 -4
- package/dist/plain/calculate/index.js +6 -6
- package/dist/plain/calculate/maxDate.js +8 -5
- package/dist/plain/calculate/maxDateTime.js +8 -5
- package/dist/plain/calculate/maxTime.js +8 -5
- package/dist/plain/calculate/minDate.js +8 -5
- package/dist/plain/calculate/minDateTime.js +8 -5
- package/dist/plain/calculate/minTime.js +8 -5
- package/dist/plain/calculate/nextWeekday.js +6 -6
- package/dist/plain/calculate/previousWeekday.js +6 -6
- package/dist/plain/calculate/roundDate.js +8 -8
- package/dist/plain/calculate/roundDateTime.js +8 -8
- package/dist/plain/calculate/roundTime.js +9 -8
- package/dist/plain/calculate/setDate.js +5 -9
- package/dist/plain/calculate/setDateTime.js +5 -9
- package/dist/plain/calculate/setTime.js +5 -9
- package/dist/plain/calculate/sortDateTimes.js +7 -3
- package/dist/plain/calculate/sortDates.js +7 -3
- package/dist/plain/calculate/sortTimes.js +7 -3
- package/dist/plain/calculate/startOfDate.js +6 -26
- package/dist/plain/calculate/startOfDateTime.js +9 -63
- package/dist/plain/calculate/startOfQuarterForDate.js +3 -4
- package/dist/plain/calculate/startOfQuarterForDateTime.js +3 -4
- package/dist/plain/calculate/startOfTime.js +5 -4
- package/dist/plain/calculate/subtractDate.js +6 -8
- package/dist/plain/calculate/subtractDateTime.js +6 -7
- package/dist/plain/calculate/subtractTime.js +6 -7
- package/dist/plain/calculate/weekOfYearForDate.js +4 -4
- package/dist/plain/calculate/weekOfYearForDateTime.js +3 -3
- package/dist/plain/chop/chopDate.js +4 -4
- package/dist/plain/chop/chopMilliseconds.js +5 -5
- package/dist/plain/chop/chopSeconds.js +5 -5
- package/dist/plain/chop/chopTime.js +4 -4
- package/dist/plain/compare/areDateTimesEqual.js +4 -5
- package/dist/plain/compare/areDateTimesEqualBy.js +7 -8
- package/dist/plain/compare/areDatesEqual.js +2 -10
- package/dist/plain/compare/areDatesEqualBy.js +7 -8
- package/dist/plain/compare/areTimesEqual.js +4 -5
- package/dist/plain/compare/isAfterDate.js +5 -3
- package/dist/plain/compare/isAfterDateTime.js +5 -3
- package/dist/plain/compare/isAfterTime.js +5 -3
- package/dist/plain/compare/isBeforeDate.js +5 -3
- package/dist/plain/compare/isBeforeDateTime.js +5 -3
- package/dist/plain/compare/isBeforeTime.js +5 -3
- package/dist/plain/compare/isBetweenDate.js +8 -8
- package/dist/plain/compare/isBetweenDateTime.js +8 -8
- package/dist/plain/compare/isBetweenTime.js +8 -8
- package/dist/plain/compare/isBusinessDay.js +4 -4
- package/dist/plain/compare/isFuture.d.ts +1 -1
- package/dist/plain/compare/isFuture.js +3 -8
- package/dist/plain/compare/isPast.d.ts +1 -1
- package/dist/plain/compare/isPast.js +3 -8
- package/dist/plain/compare/isRelativeDay.d.ts +1 -1
- package/dist/plain/compare/isRelativeDay.js +12 -11
- package/dist/plain/compare/isThisUnit.d.ts +1 -1
- package/dist/plain/compare/isThisUnit.js +14 -12
- package/dist/plain/compare/isWeekend.js +3 -4
- package/dist/plain/convert/convertDateToCalendar.js +4 -4
- package/dist/plain/format/formatCalendar.js +10 -10
- package/dist/plain/format/formatDate.js +4 -4
- package/dist/plain/format/formatDateRange.js +7 -5
- package/dist/plain/format/formatDateTime.js +4 -4
- package/dist/plain/format/formatDateTimeRange.js +8 -5
- package/dist/plain/format/formatDateTimeToParts.js +4 -4
- package/dist/plain/format/formatDateToParts.js +4 -4
- package/dist/plain/format/formatRelativeDate.js +8 -8
- package/dist/plain/format/formatRelativeDateTime.js +8 -8
- package/dist/plain/format/formatRelativeTime.js +8 -8
- package/dist/plain/format/formatSqlDateTime.js +3 -4
- package/dist/plain/format/formatTime.js +4 -3
- package/dist/plain/get/getDateAgo.js +4 -4
- package/dist/plain/get/getDateIn.js +4 -4
- package/dist/plain/get/getDateTimeAgo.js +4 -4
- package/dist/plain/get/getDateTimeIn.js +4 -4
- package/dist/plain/get/getDay.js +2 -2
- package/dist/plain/get/getDayOfWeek.js +2 -2
- package/dist/plain/get/getHour.js +2 -2
- package/dist/plain/get/getMicrosecond.js +2 -2
- package/dist/plain/get/getMillisecond.js +2 -2
- package/dist/plain/get/getMinute.js +2 -2
- package/dist/plain/get/getMonth.js +2 -2
- package/dist/plain/get/getNanosecond.js +2 -2
- package/dist/plain/get/getNow.js +2 -2
- package/dist/plain/get/getNowUnit.js +6 -6
- package/dist/plain/get/getSecond.js +2 -2
- package/dist/plain/get/getTimeAgo.js +4 -4
- package/dist/plain/get/getTimeIn.js +4 -4
- package/dist/plain/get/getToday.js +2 -9
- package/dist/plain/get/getWeekOfYear.js +2 -2
- package/dist/plain/get/getYear.js +2 -2
- package/dist/plain/get/index.js +1 -1
- package/dist/plain/index.js +73 -73
- package/dist/plain/interval/index.js +3 -3
- package/dist/plain/interval/intervalAbutsDate.js +6 -7
- package/dist/plain/interval/intervalAbutsDateTime.js +6 -6
- package/dist/plain/interval/intervalAbutsTime.js +6 -6
- package/dist/plain/interval/intervalContainsDate.js +7 -8
- package/dist/plain/interval/intervalContainsDateTime.js +7 -7
- package/dist/plain/interval/intervalContainsTime.js +7 -7
- package/dist/plain/interval/intervalCountDate.js +5 -5
- package/dist/plain/interval/intervalCountDateTime.js +8 -9
- package/dist/plain/interval/intervalCountTime.js +6 -6
- package/dist/plain/interval/intervalDifferenceDate.js +6 -7
- package/dist/plain/interval/intervalDifferenceDateTime.js +6 -6
- package/dist/plain/interval/intervalDifferenceTime.js +6 -6
- package/dist/plain/interval/intervalDivideEquallyDate.js +4 -5
- package/dist/plain/interval/intervalDivideEquallyDateTime.js +4 -5
- package/dist/plain/interval/intervalDivideEquallyTime.js +4 -5
- package/dist/plain/interval/intervalEngulfsDate.js +6 -7
- package/dist/plain/interval/intervalEngulfsDateTime.js +6 -6
- package/dist/plain/interval/intervalEngulfsTime.js +6 -6
- package/dist/plain/interval/intervalFromDurationDate.js +7 -8
- package/dist/plain/interval/intervalFromDurationDateTime.js +5 -6
- package/dist/plain/interval/intervalFromDurationTime.js +5 -7
- package/dist/plain/interval/intervalIntersectionDate.js +6 -7
- package/dist/plain/interval/intervalIntersectionDateTime.js +6 -6
- package/dist/plain/interval/intervalIntersectionTime.js +6 -6
- package/dist/plain/interval/intervalLengthDate.js +5 -5
- package/dist/plain/interval/intervalLengthDateTime.js +6 -7
- package/dist/plain/interval/intervalLengthTime.js +6 -7
- package/dist/plain/interval/intervalOverlappingDaysDate.js +6 -7
- package/dist/plain/interval/intervalOverlappingDaysDateTime.js +6 -6
- package/dist/plain/interval/intervalSplitAtDate.js +14 -8
- package/dist/plain/interval/intervalSplitAtDateTime.js +14 -7
- package/dist/plain/interval/intervalSplitAtTime.js +14 -7
- package/dist/plain/interval/intervalUnionDate.js +6 -7
- package/dist/plain/interval/intervalUnionDateTime.js +6 -6
- package/dist/plain/interval/intervalUnionTime.js +6 -6
- package/dist/plain/interval/intervalXorAllDate.js +13 -8
- package/dist/plain/interval/intervalXorAllDateTime.js +12 -6
- package/dist/plain/interval/intervalXorAllTime.js +12 -6
- package/dist/plain/interval/intervalXorDate.js +6 -7
- package/dist/plain/interval/intervalXorDateTime.js +6 -6
- package/dist/plain/interval/intervalXorTime.js +6 -6
- package/dist/plain/interval/intervalsOverlapDate.js +6 -7
- package/dist/plain/interval/intervalsOverlapDateTime.js +6 -6
- package/dist/plain/interval/intervalsOverlapTime.js +6 -6
- package/dist/plain/interval/mergeIntervalsDate.js +11 -8
- package/dist/plain/interval/mergeIntervalsDateTime.js +10 -6
- package/dist/plain/interval/mergeIntervalsTime.js +10 -6
- package/dist/plain/interval/splitIntervalByUnitDate.js +4 -4
- package/dist/plain/interval/splitIntervalByUnitDateTime.js +6 -6
- package/dist/plain/interval/splitIntervalByUnitTime.js +6 -6
- package/dist/plain/interval/validate/isValidDateInterval.js +2 -10
- package/dist/plain/interval/validate/isValidDateTimeInterval.d.ts +4 -5
- package/dist/plain/interval/validate/isValidDateTimeInterval.js +6 -14
- package/dist/plain/interval/validate/isValidTimeInterval.d.ts +4 -5
- package/dist/plain/interval/validate/isValidTimeInterval.js +6 -14
- package/dist/plain/locale/getLocaleEraNames.js +2 -35
- package/dist/plain/locale/getLocaleMeridiems.js +2 -18
- package/dist/plain/locale/getLocaleMonthNames.js +2 -24
- package/dist/plain/locale/getLocaleWeekdayNames.js +2 -26
- package/dist/plain/map/mapDatesInRange.js +4 -4
- package/dist/plain/parse/parseDayFromDate.js +4 -4
- package/dist/plain/parse/parseDayFromDateTime.js +4 -4
- package/dist/plain/parse/parseDayOfWeekFromDate.js +4 -4
- package/dist/plain/parse/parseDayOfWeekFromDateTime.js +4 -4
- package/dist/plain/parse/parseHourFromDateTime.js +4 -4
- package/dist/plain/parse/parseHourFromTime.js +4 -4
- package/dist/plain/parse/parseMicrosecondFromDateTime.js +4 -4
- package/dist/plain/parse/parseMicrosecondFromTime.js +4 -4
- package/dist/plain/parse/parseMillisecondFromDateTime.js +4 -4
- package/dist/plain/parse/parseMillisecondFromTime.js +4 -4
- package/dist/plain/parse/parseMinuteFromDateTime.js +4 -4
- package/dist/plain/parse/parseMinuteFromTime.js +4 -4
- package/dist/plain/parse/parseMonthDay.d.ts +2 -3
- package/dist/plain/parse/parseMonthDay.js +2 -3
- package/dist/plain/parse/parseMonthDayFromDate.js +4 -4
- package/dist/plain/parse/parseMonthDayFromDateTime.d.ts +3 -3
- package/dist/plain/parse/parseMonthDayFromDateTime.js +3 -3
- package/dist/plain/parse/parseMonthFromDate.js +4 -4
- package/dist/plain/parse/parseMonthFromDateTime.js +4 -4
- package/dist/plain/parse/parseNanosecondFromDateTime.js +4 -4
- package/dist/plain/parse/parseNanosecondFromTime.js +4 -4
- package/dist/plain/parse/parseSecondFromDateTime.js +4 -4
- package/dist/plain/parse/parseSecondFromTime.js +4 -4
- package/dist/plain/parse/parseUnitFromDate.js +5 -6
- package/dist/plain/parse/parseUnitFromDateTime.js +5 -6
- package/dist/plain/parse/parseUnitFromTime.js +3 -4
- package/dist/plain/parse/parseWeekFromDate.js +5 -4
- package/dist/plain/parse/parseWeekFromDateTime.js +5 -5
- package/dist/plain/parse/parseYearFromDate.js +3 -4
- package/dist/plain/parse/parseYearFromDateTime.js +3 -4
- package/dist/plain/parse/parseYearMonth.d.ts +2 -3
- package/dist/plain/parse/parseYearMonth.js +2 -3
- package/dist/plain/parse/parseYearMonthFromDate.js +4 -4
- package/dist/plain/parse/parseYearMonthFromDateTime.d.ts +3 -2
- package/dist/plain/parse/parseYearMonthFromDateTime.js +3 -2
- package/dist/plain/validate/hasSecond60.d.ts +29 -24
- package/dist/plain/validate/hasSecond60.js +41 -27
- package/dist/plain/validate/index.js +5 -5
- package/dist/plain/validate/isLeapYear.js +4 -4
- package/dist/plain/validate/isValidCalendarDate.d.ts +5 -7
- package/dist/plain/validate/isValidCalendarDate.js +2 -8
- package/dist/plain/validate/isValidDate.d.ts +6 -7
- package/dist/plain/validate/isValidDate.js +2 -2
- package/dist/plain/validate/isValidDateCycleField.js +3 -2
- package/dist/plain/validate/isValidDateDurationUnit.js +3 -1
- package/dist/plain/validate/isValidDateRange.d.ts +2 -2
- package/dist/plain/validate/isValidDateRange.js +8 -8
- package/dist/plain/validate/isValidDateTime.d.ts +6 -7
- package/dist/plain/validate/isValidDateTime.js +1 -1
- package/dist/plain/validate/isValidDateTimeCycleField.js +2 -3
- package/dist/plain/validate/isValidDateTimeDurationUnit.js +3 -1
- package/dist/plain/validate/isValidDateTimeRange.js +6 -5
- package/dist/plain/validate/isValidDateTimeUnit.js +3 -2
- package/dist/plain/validate/isValidDateUnit.js +3 -2
- package/dist/plain/validate/isValidIsoDateLike.d.ts +5 -6
- package/dist/plain/validate/isValidIsoDateLike.js +2 -19
- package/dist/plain/validate/isValidMonthDay.d.ts +5 -8
- package/dist/plain/validate/isValidTime.d.ts +5 -6
- package/dist/plain/validate/isValidTime.js +2 -2
- package/dist/plain/validate/isValidTimeCycleField.js +3 -2
- package/dist/plain/validate/isValidTimeDurationUnit.js +3 -1
- package/dist/plain/validate/isValidTimeRange.js +6 -5
- package/dist/plain/validate/isValidTimeUnit.js +3 -2
- package/dist/plain/validate/isValidYearMonth.d.ts +5 -8
- package/dist/precision/calculate/truncateNanoseconds.js +2 -9
- package/dist/precision/convert/fromDotNetTicks.js +2 -2
- package/dist/precision/convert/fromExcelSerial.js +4 -4
- package/dist/precision/convert/fromFileTime.js +2 -2
- package/dist/precision/convert/fromNanoseconds.js +2 -11
- package/dist/precision/convert/fromNtpTimestamp.js +2 -2
- package/dist/precision/convert/fromPgMicroseconds.js +2 -2
- package/dist/precision/convert/index.js +1 -1
- package/dist/precision/convert/toArrowLocalTimestamp.d.ts +2 -3
- package/dist/precision/convert/toArrowLocalTimestamp.js +2 -3
- package/dist/precision/convert/toArrowTimestamp.d.ts +5 -4
- package/dist/precision/convert/toArrowTimestamp.js +5 -4
- package/dist/precision/convert/toExcelSerial.js +2 -2
- package/dist/precision/convert/toNanoseconds.d.ts +8 -14
- package/dist/precision/convert/toNanoseconds.js +8 -14
- package/dist/precision/convert/toParquetInt96.d.ts +1 -1
- package/dist/precision/convert/toParquetInt96.js +1 -1
- package/dist/precision/convert/toPgMicroseconds.js +2 -2
- package/dist/precision/convert/toProtoTimestamp.d.ts +1 -1
- package/dist/precision/convert/toProtoTimestamp.js +1 -1
- package/dist/precision/identifiers/ulidTimestampPrefix.d.ts +4 -3
- package/dist/precision/identifiers/ulidTimestampPrefix.js +4 -3
- package/dist/precision/identifiers/uuidV7TimestampPrefix.d.ts +4 -3
- package/dist/precision/identifiers/uuidV7TimestampPrefix.js +4 -3
- package/dist/precision/index.js +6 -6
- package/dist/precision/parse/parseNanoseconds.js +2 -2
- package/dist/precision/validate/isValidInstant.d.ts +9 -20
- package/dist/precision/validate/isValidInstant.js +2 -2
- package/dist/precision/validate/isValidInt64NanosecondDateTime.d.ts +1 -1
- package/dist/precision/validate/isValidNanoPattern.js +2 -5
- package/dist/rail/convert/gtfsToInstant.d.ts +46 -0
- package/dist/rail/convert/gtfsToInstant.js +69 -0
- package/dist/rail/convert/index.d.ts +2 -0
- package/dist/rail/convert/index.js +3 -0
- package/dist/rail/format/formatGtfsTime.d.ts +25 -0
- package/dist/rail/format/formatGtfsTime.js +37 -0
- package/dist/rail/format/index.d.ts +2 -0
- package/dist/rail/format/index.js +3 -0
- package/dist/rail/index.d.ts +8 -0
- package/dist/rail/index.js +7 -0
- package/dist/rail/parse/index.d.ts +2 -0
- package/dist/rail/parse/index.js +3 -0
- package/dist/rail/parse/parseGtfsTime.d.ts +27 -0
- package/dist/rail/parse/parseGtfsTime.js +32 -0
- package/dist/rail/validate/index.d.ts +2 -0
- package/dist/rail/validate/index.js +3 -0
- package/dist/rail/validate/isValidGtfsTime.d.ts +21 -0
- package/dist/rail/validate/isValidGtfsTime.js +28 -0
- package/dist/recurrence/calculate/cronRuns.js +1 -1
- package/dist/recurrence/calculate/expandRecurrence.js +3 -3
- package/dist/recurrence/parse/parseRecurrenceRule.d.ts +1 -1
- package/dist/recurrence/parse/parseRecurrenceRule.js +1 -1
- package/dist/regex/calendar-date.d.ts +2 -2
- package/dist/regex/calendar-date.js +2 -2
- package/dist/regex/calendar-zoned-date-time.d.ts +2 -3
- package/dist/regex/calendar-zoned-date-time.js +2 -3
- package/dist/regex/date-time.d.ts +3 -3
- package/dist/regex/date-time.js +3 -3
- package/dist/regex/date.d.ts +3 -3
- package/dist/regex/date.js +3 -3
- package/dist/regex/fhir.d.ts +74 -0
- package/dist/regex/fhir.js +77 -0
- package/dist/regex/index.d.ts +2 -1
- package/dist/regex/index.js +4 -3
- package/dist/regex/leap-second.d.ts +3 -2
- package/dist/regex/leap-second.js +3 -2
- package/dist/regex/month-day.d.ts +3 -2
- package/dist/regex/month-day.js +3 -2
- package/dist/regex/time.d.ts +3 -3
- package/dist/regex/time.js +3 -3
- package/dist/regex/utc-date-time.d.ts +3 -3
- package/dist/regex/utc-date-time.js +3 -3
- package/dist/regex/year-month.d.ts +3 -2
- package/dist/regex/year-month.js +3 -2
- package/dist/span/calculate/index.js +1 -1
- package/dist/span/calculate/spanMs.d.ts +8 -17
- package/dist/span/calculate/spanMs.js +10 -19
- package/dist/span/calculate/spanNs.d.ts +8 -17
- package/dist/span/calculate/spanNs.js +10 -22
- package/dist/span/calculate/spanSeconds.d.ts +2 -2
- package/dist/span/calculate/spanSeconds.js +4 -4
- package/dist/span/calculate/spanWallClock.js +4 -2
- package/dist/span/index.js +1 -1
- package/dist/span/validate/isValidSpan.d.ts +4 -13
- package/dist/span/validate/isValidSpan.js +4 -13
- package/dist/timescale/calculate/index.d.ts +2 -1
- package/dist/timescale/calculate/index.js +2 -1
- package/dist/timescale/calculate/leapSecondsBetween.js +1 -1
- package/dist/timescale/calculate/nextLeapSecond.js +1 -1
- package/dist/timescale/calculate/taiMinusUtc.js +1 -1
- package/dist/timescale/calculate/tcgMinusTt.d.ts +21 -0
- package/dist/timescale/calculate/tcgMinusTt.js +38 -0
- package/dist/timescale/convert/fromJ2000Seconds.d.ts +29 -0
- package/dist/timescale/convert/fromJ2000Seconds.js +46 -0
- package/dist/timescale/convert/fromJulianDate.d.ts +28 -0
- package/dist/timescale/convert/fromJulianDate.js +45 -0
- package/dist/timescale/convert/fromJulianDateParts.d.ts +35 -0
- package/dist/timescale/convert/fromJulianDateParts.js +61 -0
- package/dist/timescale/convert/fromModifiedJulianDate.d.ts +30 -0
- package/dist/timescale/convert/fromModifiedJulianDate.js +47 -0
- package/dist/timescale/convert/fromTAI.d.ts +3 -2
- package/dist/timescale/convert/fromTAI.js +5 -4
- package/dist/timescale/convert/fromTCG.d.ts +26 -0
- package/dist/timescale/convert/fromTCG.js +43 -0
- package/dist/timescale/convert/fromTT.d.ts +24 -0
- package/dist/timescale/convert/fromTT.js +41 -0
- package/dist/timescale/convert/fromTai64n.d.ts +36 -0
- package/dist/timescale/convert/fromTai64n.js +52 -0
- package/dist/timescale/convert/index.d.ts +15 -1
- package/dist/timescale/convert/index.js +15 -1
- package/dist/timescale/convert/toJ2000Seconds.d.ts +37 -0
- package/dist/timescale/convert/toJ2000Seconds.js +58 -0
- package/dist/timescale/convert/toJulianDate.d.ts +31 -0
- package/dist/timescale/convert/toJulianDate.js +50 -0
- package/dist/timescale/convert/toJulianDateParts.d.ts +32 -0
- package/dist/timescale/convert/toJulianDateParts.js +49 -0
- package/dist/timescale/convert/toModifiedJulianDate.d.ts +36 -0
- package/dist/timescale/convert/toModifiedJulianDate.js +55 -0
- package/dist/timescale/convert/toTAI.d.ts +1 -1
- package/dist/timescale/convert/toTAI.js +2 -2
- package/dist/timescale/convert/toTCG.d.ts +27 -0
- package/dist/timescale/convert/toTCG.js +48 -0
- package/dist/timescale/convert/toTT.d.ts +25 -0
- package/dist/timescale/convert/toTT.js +46 -0
- package/dist/timescale/convert/toTai64n.d.ts +30 -0
- package/dist/timescale/convert/toTai64n.js +46 -0
- package/dist/timescale/format/formatCcsdsAsciiA.d.ts +26 -0
- package/dist/timescale/format/formatCcsdsAsciiA.js +40 -0
- package/dist/timescale/format/formatCcsdsAsciiB.d.ts +27 -0
- package/dist/timescale/format/formatCcsdsAsciiB.js +41 -0
- package/dist/timescale/format/index.d.ts +3 -0
- package/dist/timescale/format/index.js +4 -0
- package/dist/timescale/index.d.ts +21 -1
- package/dist/timescale/index.js +20 -1
- package/dist/timescale/parse/index.d.ts +3 -0
- package/dist/timescale/parse/index.js +4 -0
- package/dist/timescale/parse/parseCcsdsAsciiA.d.ts +24 -0
- package/dist/timescale/parse/parseCcsdsAsciiA.js +43 -0
- package/dist/timescale/parse/parseCcsdsAsciiB.d.ts +26 -0
- package/dist/timescale/parse/parseCcsdsAsciiB.js +46 -0
- package/dist/timescale/validate/isLeapSecond.js +1 -1
- package/dist/transport/calculate/bestAvailable.d.ts +3 -5
- package/dist/transport/calculate/bestAvailable.js +3 -5
- package/dist/transport/calculate/crossingTime.d.ts +6 -11
- package/dist/transport/calculate/crossingTime.js +12 -17
- package/dist/transport/calculate/cutoffAt.d.ts +6 -7
- package/dist/transport/calculate/cutoffAt.js +9 -10
- package/dist/transport/calculate/cutoffSchedule.d.ts +1 -1
- package/dist/transport/calculate/cutoffSchedule.js +4 -4
- package/dist/transport/calculate/dwellTime.d.ts +8 -10
- package/dist/transport/calculate/dwellTime.js +19 -27
- package/dist/transport/calculate/estimateDrift.d.ts +4 -5
- package/dist/transport/calculate/estimateDrift.js +4 -5
- package/dist/transport/calculate/index.js +1 -1
- package/dist/transport/calculate/nextDeparture.d.ts +1 -1
- package/dist/transport/calculate/nextDeparture.js +3 -3
- package/dist/transport/calculate/punctualityRate.d.ts +2 -2
- package/dist/transport/calculate/punctualityRate.js +1 -1
- package/dist/transport/calculate/scheduleDelivery.js +2 -183
- package/dist/transport/calculate/transitTime.d.ts +4 -6
- package/dist/transport/calculate/transitTime.js +6 -22
- package/dist/transport/compare/classifyPunctuality.d.ts +5 -7
- package/dist/transport/compare/classifyPunctuality.js +5 -7
- package/dist/transport/compare/isPastCutoff.d.ts +12 -13
- package/dist/transport/compare/isPastCutoff.js +19 -17
- package/dist/transport/compare/scheduleDeviation.d.ts +6 -14
- package/dist/transport/compare/scheduleDeviation.js +12 -18
- package/dist/transport/compare/timeToCutoff.d.ts +9 -12
- package/dist/transport/compare/timeToCutoff.js +16 -16
- package/dist/transport/convert/etaAtZone.d.ts +3 -11
- package/dist/transport/convert/etaAtZone.js +5 -20
- package/dist/transport/index.js +2 -2
- package/dist/types/duration-relative-to.d.ts +5 -4
- package/dist/types/duty.d.ts +3 -0
- package/dist/types/fhir.d.ts +28 -0
- package/dist/types/fhir.js +0 -0
- package/dist/types/fix.d.ts +41 -0
- package/dist/types/fix.js +0 -0
- package/dist/types/gnss.d.ts +4 -1
- package/dist/types/gtfs.d.ts +17 -0
- package/dist/types/gtfs.js +0 -0
- package/dist/types/hl7.d.ts +110 -0
- package/dist/types/hl7.js +0 -0
- package/dist/types/index.d.ts +9 -2
- package/dist/types/interval.d.ts +3 -5
- package/dist/types/notam.d.ts +31 -0
- package/dist/types/notam.js +0 -0
- package/dist/types/ptp.d.ts +16 -0
- package/dist/types/ptp.js +0 -0
- package/dist/types/time-scale.d.ts +21 -0
- package/dist/types/time-scale.js +0 -0
- package/dist/types/transport-timestamps.d.ts +2 -2
- package/dist/unix/calculate/addUnix.js +3 -3
- package/dist/unix/calculate/diffUnix.js +7 -9
- package/dist/unix/calculate/diffUnixAsDuration.js +2 -2
- package/dist/unix/calculate/endOfUnix.js +2 -2
- package/dist/unix/calculate/isBetweenUnix.js +3 -3
- package/dist/unix/calculate/roundUnix.js +6 -5
- package/dist/unix/calculate/setUnix.js +4 -4
- package/dist/unix/calculate/startOfUnix.js +2 -2
- package/dist/unix/calculate/subtractUnix.js +3 -3
- package/dist/unix/compare/areUnixEqualBy.js +7 -3
- package/dist/unix/convert/convertUnixToZoned.js +2 -2
- package/dist/unix/format/formatCalendarUnix.js +4 -4
- package/dist/unix/format/formatRelativeUnix.js +2 -2
- package/dist/unix/format/formatUnix.js +2 -2
- package/dist/unix/get/getUnixAgo.js +2 -2
- package/dist/unix/get/getUnixIn.js +2 -2
- package/dist/unix/get/getUnixNowUnit.js +2 -2
- package/dist/unix/index.js +1 -1
- package/dist/unix/interval/intervalFromDurationUnix.js +4 -4
- package/dist/unix/parse/index.js +1 -1
- package/dist/unix/parse/parseDayFromUnix.js +2 -2
- package/dist/unix/parse/parseHourFromUnix.js +2 -2
- package/dist/unix/parse/parseMicrosecondFromUnix.js +2 -2
- package/dist/unix/parse/parseMillisecondFromUnix.js +2 -2
- package/dist/unix/parse/parseMinuteFromUnix.js +2 -2
- package/dist/unix/parse/parseMonthFromUnix.js +2 -2
- package/dist/unix/parse/parseNanosecondFromUnix.js +2 -2
- package/dist/unix/parse/parseSecondFromUnix.js +2 -2
- package/dist/unix/parse/parseUnitFromUnix.js +2 -26
- package/dist/unix/parse/parseWeekFromUnix.js +2 -2
- package/dist/unix/parse/parseYearFromUnix.js +2 -2
- package/dist/unix/validate/isValidUnixRange.js +2 -1
- package/dist/utc/calculate/addUtc.js +6 -7
- package/dist/utc/calculate/diffUtc.js +12 -16
- package/dist/utc/calculate/diffUtcAsDuration.js +6 -9
- package/dist/utc/calculate/endOfQuarterForUtc.js +4 -4
- package/dist/utc/calculate/isBetweenUtc.js +10 -15
- package/dist/utc/calculate/maxUtc.js +4 -5
- package/dist/utc/calculate/minUtc.js +4 -5
- package/dist/utc/calculate/roundUtc.js +10 -8
- package/dist/utc/calculate/secondsUntilHttpDate.js +4 -5
- package/dist/utc/calculate/secondsUntilRetryAfter.js +4 -5
- package/dist/utc/calculate/setUtc.js +4 -4
- package/dist/utc/calculate/sortUtc.js +3 -4
- package/dist/utc/calculate/startOfQuarterForUtc.js +4 -4
- package/dist/utc/calculate/subtractUtc.js +6 -7
- package/dist/utc/chop/chopUtc.d.ts +2 -2
- package/dist/utc/chop/chopUtc.js +5 -6
- package/dist/utc/compare/areUtcEqual.js +5 -4
- package/dist/utc/compare/areUtcEqualBy.js +6 -8
- package/dist/utc/compare/isAfterUtc.js +5 -4
- package/dist/utc/compare/isBeforeUtc.js +5 -4
- package/dist/utc/convert/convertUtcToPlainDate.js +3 -4
- package/dist/utc/convert/convertUtcToPlainDateTime.js +3 -4
- package/dist/utc/convert/convertUtcToPlainTime.js +3 -4
- package/dist/utc/convert/convertUtcToUnix.js +4 -4
- package/dist/utc/convert/convertUtcToZoned.js +5 -5
- package/dist/utc/format/formatCalendarUtc.js +16 -12
- package/dist/utc/format/formatHttpDate.js +4 -4
- package/dist/utc/format/formatHttpDateFromNow.js +2 -2
- package/dist/utc/format/formatRelativeUtc.js +14 -10
- package/dist/utc/format/formatUtc.js +5 -7
- package/dist/utc/get/getUtcAgo.js +2 -2
- package/dist/utc/get/getUtcIn.js +2 -2
- package/dist/utc/get/getUtcNowUnit.js +2 -2
- package/dist/utc/index.js +6 -6
- package/dist/utc/interval/index.js +1 -1
- package/dist/utc/interval/intervalAbutsUtc.js +9 -6
- package/dist/utc/interval/intervalContainsUtc.js +19 -16
- package/dist/utc/interval/intervalCountUtc.js +8 -6
- package/dist/utc/interval/intervalDifferenceUtc.js +7 -11
- package/dist/utc/interval/intervalDivideEquallyUtc.js +4 -4
- package/dist/utc/interval/intervalEngulfsUtc.js +9 -6
- package/dist/utc/interval/intervalFromDurationUtc.js +7 -6
- package/dist/utc/interval/intervalIntersectionUtc.js +7 -12
- package/dist/utc/interval/intervalLengthUtc.js +7 -7
- package/dist/utc/interval/intervalOverlappingDaysUtc.js +9 -6
- package/dist/utc/interval/intervalSplitAtUtc.js +13 -7
- package/dist/utc/interval/intervalUnionUtc.js +11 -12
- package/dist/utc/interval/intervalXorAllUtc.js +6 -5
- package/dist/utc/interval/intervalXorUtc.js +9 -6
- package/dist/utc/interval/intervalsOverlapUtc.js +7 -10
- package/dist/utc/interval/mergeIntervalsUtc.js +13 -5
- package/dist/utc/interval/splitIntervalByUnitUtc.js +6 -6
- package/dist/utc/interval/validate/isValidUtcInterval.d.ts +3 -4
- package/dist/utc/interval/validate/isValidUtcInterval.js +5 -15
- package/dist/utc/parse/index.js +1 -1
- package/dist/utc/parse/parseDayOfWeekFromUtc.js +4 -4
- package/dist/utc/parse/parseHttpDate.js +2 -35
- package/dist/utc/parse/parseTimeFromUtc.js +3 -4
- package/dist/utc/parse/parseUnitFromUtc.js +7 -7
- package/dist/utc/parse/parseWeekFromUtc.js +6 -7
- package/dist/utc/validate/index.js +1 -1
- package/dist/utc/validate/isValidHttpDate.js +2 -2
- package/dist/utc/validate/isValidUtc.d.ts +3 -5
- package/dist/utc/validate/isValidUtc.js +2 -14
- package/dist/utc/validate/isValidUtcRange.js +7 -5
- package/dist/utc/validate/isValidUtcTimestamp.js +2 -2
- package/dist/workforce/calculate/dutyDayFor.js +1 -1
- package/dist/zoned/calculate/addZoned.js +8 -10
- package/dist/zoned/calculate/addZonedBusinessDays.js +5 -4
- package/dist/zoned/calculate/clampZoned.js +5 -6
- package/dist/zoned/calculate/closestZonedTo.js +8 -13
- package/dist/zoned/calculate/cycleZoned.js +15 -11
- package/dist/zoned/calculate/diffZoned.js +9 -11
- package/dist/zoned/calculate/diffZonedAsDuration.js +5 -5
- package/dist/zoned/calculate/endOfQuarterForZoned.js +6 -6
- package/dist/zoned/calculate/getHoursInZonedDay.js +4 -4
- package/dist/zoned/calculate/getLocaleZonedDayOfWeek.js +4 -4
- package/dist/zoned/calculate/getLocaleZonedEndOfWeek.js +6 -6
- package/dist/zoned/calculate/getLocaleZonedStartOfWeek.js +6 -6
- package/dist/zoned/calculate/getQuarterForZoned.js +3 -4
- package/dist/zoned/calculate/index.js +1 -1
- package/dist/zoned/calculate/maxZoned.js +3 -7
- package/dist/zoned/calculate/minZoned.js +3 -7
- package/dist/zoned/calculate/roundZoned.js +7 -7
- package/dist/zoned/calculate/setZoned.js +9 -14
- package/dist/zoned/calculate/sortZoned.js +3 -5
- package/dist/zoned/calculate/startOfQuarterForZoned.js +6 -6
- package/dist/zoned/calculate/subtractZoned.js +8 -10
- package/dist/zoned/calculate/subtractZonedBusinessDays.js +5 -4
- package/dist/zoned/chop/chopZonedDate.js +4 -4
- package/dist/zoned/chop/chopZonedDateTime.js +4 -4
- package/dist/zoned/chop/chopZonedMilliseconds.js +4 -4
- package/dist/zoned/chop/chopZonedSeconds.js +4 -4
- package/dist/zoned/chop/chopZonedTime.js +4 -4
- package/dist/zoned/chop/chopZonedTimezone.js +4 -4
- package/dist/zoned/classify/classifyStoredZoned.js +3 -3
- package/dist/zoned/compare/areZonedEqual.js +4 -11
- package/dist/zoned/compare/areZonedEqualBy.js +6 -7
- package/dist/zoned/compare/isAfterZoned.js +4 -11
- package/dist/zoned/compare/isBeforeZoned.js +4 -11
- package/dist/zoned/compare/isBetweenZoned.js +8 -16
- package/dist/zoned/compare/isInDaylightSaving.js +4 -4
- package/dist/zoned/compare/isZonedBusinessDay.js +3 -4
- package/dist/zoned/compare/isZonedFuture.js +4 -4
- package/dist/zoned/compare/isZonedPast.js +4 -4
- package/dist/zoned/compare/isZonedRelativeDay.js +3 -4
- package/dist/zoned/compare/isZonedThisUnit.js +13 -14
- package/dist/zoned/compare/isZonedWeekend.js +3 -4
- package/dist/zoned/convert/convertPlainDateTimeToZoned.js +7 -9
- package/dist/zoned/convert/convertZonedToCalendar.js +4 -4
- package/dist/zoned/convert/convertZonedToPlainDateTime.js +4 -4
- package/dist/zoned/convert/convertZonedToUnix.js +4 -4
- package/dist/zoned/convert/convertZonedToUtc.js +4 -4
- package/dist/zoned/convert/convertZonedToZoned.js +5 -5
- package/dist/zoned/format/formatCalendarZoned.js +12 -11
- package/dist/zoned/format/formatRelativeZoned.js +10 -8
- package/dist/zoned/format/formatRfc2822.js +3 -4
- package/dist/zoned/format/formatRfc3339.js +3 -4
- package/dist/zoned/format/formatTimeZoneName.js +6 -6
- package/dist/zoned/format/formatZonedDateTime.js +3 -4
- package/dist/zoned/format/formatZonedRange.js +103 -20
- package/dist/zoned/format/formatZonedToParts.js +3 -4
- package/dist/zoned/get/getSystemTimeZone.js +2 -7
- package/dist/zoned/get/getTimeZoneOffset.d.ts +4 -6
- package/dist/zoned/get/getTimeZoneOffset.js +4 -6
- package/dist/zoned/get/getZonedAgo.js +4 -4
- package/dist/zoned/get/getZonedIn.js +4 -4
- package/dist/zoned/get/getZonedNow.js +4 -4
- package/dist/zoned/get/getZonedNowUnit.js +2 -2
- package/dist/zoned/get/getZonedYear.js +1 -1
- package/dist/zoned/get/index.js +1 -1
- package/dist/zoned/index.js +13 -13
- package/dist/zoned/interval/index.js +2 -2
- package/dist/zoned/interval/intervalAbutsZoned.js +6 -7
- package/dist/zoned/interval/intervalContainsZoned.js +8 -8
- package/dist/zoned/interval/intervalCountZoned.js +4 -4
- package/dist/zoned/interval/intervalDifferenceZoned.js +6 -7
- package/dist/zoned/interval/intervalDivideEquallyZoned.js +5 -5
- package/dist/zoned/interval/intervalEngulfsZoned.js +6 -7
- package/dist/zoned/interval/intervalFromDurationZoned.js +9 -10
- package/dist/zoned/interval/intervalIntersectionZoned.js +6 -7
- package/dist/zoned/interval/intervalLengthZoned.js +4 -4
- package/dist/zoned/interval/intervalOverlappingDaysZoned.js +9 -7
- package/dist/zoned/interval/intervalSplitAtZoned.js +16 -14
- package/dist/zoned/interval/intervalUnionZoned.js +6 -7
- package/dist/zoned/interval/intervalXorAllZoned.js +14 -8
- package/dist/zoned/interval/intervalXorZoned.js +6 -7
- package/dist/zoned/interval/intervalsOverlapZoned.js +6 -7
- package/dist/zoned/interval/mergeIntervalsZoned.js +13 -8
- package/dist/zoned/interval/splitIntervalByUnitZoned.js +4 -5
- package/dist/zoned/interval/validate/isValidCalendarZonedInterval.js +2 -10
- package/dist/zoned/interval/validate/isValidZonedInterval.d.ts +5 -5
- package/dist/zoned/interval/validate/isValidZonedInterval.js +11 -10
- package/dist/zoned/map/mapZonedDatesInRange.js +4 -11
- package/dist/zoned/map/mapZonedHoursInDay.js +4 -4
- package/dist/zoned/parse/getZonedOffset.js +4 -4
- package/dist/zoned/parse/getZonedOffsetAs.js +4 -4
- package/dist/zoned/parse/index.js +2 -2
- package/dist/zoned/parse/parseDateFromZoned.js +4 -4
- package/dist/zoned/parse/parseDateTimeFromZoned.js +5 -5
- package/dist/zoned/parse/parseDayFromZoned.js +4 -4
- package/dist/zoned/parse/parseDayOfWeekFromZoned.js +4 -4
- package/dist/zoned/parse/parseHourFromZoned.js +4 -4
- package/dist/zoned/parse/parseMicrosecondFromZoned.js +4 -4
- package/dist/zoned/parse/parseMillisecondFromZoned.js +4 -4
- package/dist/zoned/parse/parseMinuteFromZoned.js +4 -4
- package/dist/zoned/parse/parseMonthFromZoned.js +4 -4
- package/dist/zoned/parse/parseNanosecondFromZoned.js +4 -4
- package/dist/zoned/parse/parseRfc2822.js +2 -19
- package/dist/zoned/parse/parseRfc3339.js +2 -13
- package/dist/zoned/parse/parseSecondFromZoned.js +4 -4
- package/dist/zoned/parse/parseTimeFromZoned.js +4 -4
- package/dist/zoned/parse/parseTimeZoneFromZoned.js +4 -4
- package/dist/zoned/parse/parseUnitFromZoned.js +5 -6
- package/dist/zoned/parse/parseWeekFromZoned.js +5 -6
- package/dist/zoned/parse/parseYearFromZoned.js +3 -4
- package/dist/zoned/validate/hasDaylightSaving.d.ts +3 -4
- package/dist/zoned/validate/hasDaylightSaving.js +1 -1
- package/dist/zoned/validate/index.js +2 -2
- package/dist/zoned/validate/isValidCalendarZonedDateTime.d.ts +6 -8
- package/dist/zoned/validate/isValidCalendarZonedDateTime.js +2 -7
- package/dist/zoned/validate/isValidRfc2822DateTime.js +2 -2
- package/dist/zoned/validate/isValidRfc3339DateTime.js +2 -2
- package/dist/zoned/validate/isValidZonedDateTime.d.ts +6 -7
- package/dist/zoned/validate/isValidZonedDateTime.js +2 -11
- package/dist/zoned/validate/isValidZonedRange.d.ts +3 -3
- package/dist/zoned/validate/isValidZonedRange.js +8 -7
- package/package.json +155 -1
- package/skills/gmt-arithmetic/SKILL.md +5 -4
- package/skills/gmt-aviation/SKILL.md +124 -0
- package/skills/gmt-basics/SKILL.md +8 -7
- package/skills/gmt-finance/SKILL.md +121 -0
- package/skills/gmt-gnss/SKILL.md +6 -5
- package/skills/gmt-healthcare/SKILL.md +145 -0
- package/skills/gmt-integration/SKILL.md +63 -14
- package/skills/gmt-intermodal/SKILL.md +1 -1
- package/skills/gmt-iot/SKILL.md +95 -0
- package/skills/gmt-rail/SKILL.md +101 -0
- package/skills/gmt-timezone/SKILL.md +17 -18
- package/skills/gmt-transport/SKILL.md +6 -4
- package/skills/gmt-workforce/SKILL.md +1 -1
- package/dist/internal/temporalCompat/isoCalendarFrom.d.ts +0 -38
- package/dist/internal/temporalCompat/isoCalendarFrom.js +0 -59
- package/dist/internal/toInstantFromUtc.d.ts +0 -12
- package/dist/internal/toInstantFromUtc.js +0 -30
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** The resolved options the readers need. */
|
|
2
|
+
export type FieldContext = Pick<Intl.ResolvedDateTimeFormatOptions, "calendar" | "timeZone" | "locale" | "hourCycle">;
|
|
3
|
+
/** Forget the cached readers (the engine's `Intl.DateTimeFormat` was replaced). */
|
|
4
|
+
export declare function forgetFieldReaders(): void;
|
|
5
|
+
/**
|
|
6
|
+
* The date and time fields of an instant in a calendar and zone, read from the engine's own
|
|
7
|
+
* calendar data: `era`, `year` (or `relatedYear`), `month`, `day`, `hour` (0 to 23), `minute`,
|
|
8
|
+
* `second`.
|
|
9
|
+
*
|
|
10
|
+
* @example localFieldsOf({ calendar: "gregory", timeZone: "UTC", locale: "en", hourCycle: undefined }, 0)["year"] // "1970"
|
|
11
|
+
*/
|
|
12
|
+
export declare function localFieldsOf(resolved: FieldContext, ms: number): Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* The flexible day period the formatter prints for an instant, in its own width, or `""` when its
|
|
15
|
+
* pattern prints none (so no two instants differ in it). The period is a property of the time as
|
|
16
|
+
* the pattern prints it: with minutes, 12:00 is `noon` and 12:25 `in the afternoon`, while an
|
|
17
|
+
* hour-only pattern says `noon` for the whole hour. So the reader carries the caller's own time
|
|
18
|
+
* fields, and no date field (a week-year pattern could make a date field unsafe to read: D23).
|
|
19
|
+
*
|
|
20
|
+
* @example dayPeriodOf({ hour: "numeric", minute: "numeric", dayPeriod: "long" }, { calendar: "gregory", timeZone: "UTC", locale: "en", hourCycle: "h12" }, Date.UTC(2024, 6, 10, 12, 0)) // "noon"
|
|
21
|
+
*/
|
|
22
|
+
export declare function dayPeriodOf(options: Intl.DateTimeFormatOptions, resolved: FieldContext, ms: number): string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether two instants hold equal field values in every Table 6 row ECMA-402
|
|
25
|
+
* PartitionDateTimeRangePattern checks, so the range is the start's single format. A row is
|
|
26
|
+
* checked while no range pattern is selected, and from the first row the pattern prints until the
|
|
27
|
+
* first later row it does not print (`checkMoreFields`): a month-only pattern ignores the day, a
|
|
28
|
+
* pattern with minutes ignores the seconds. Printed text is never compared.
|
|
29
|
+
*
|
|
30
|
+
* @param options the formatter's options
|
|
31
|
+
* @param resolved its resolved calendar, zone, locale and hour cycle
|
|
32
|
+
* @param startMs the start in epoch milliseconds
|
|
33
|
+
* @param endMs the end in epoch milliseconds
|
|
34
|
+
* @param era whether the pattern prints an era (default: the `era` option is set)
|
|
35
|
+
* @returns `true` when the range collapses to the start's single format
|
|
36
|
+
*
|
|
37
|
+
* @example rangeFieldsEqual({ year: "2-digit" }, { calendar: "gregory", timeZone: "UTC", locale: "en", hourCycle: undefined }, Date.UTC(1924, 0, 1), Date.UTC(2024, 0, 1)) // false
|
|
38
|
+
*/
|
|
39
|
+
export declare function rangeFieldsEqual(options: Intl.DateTimeFormatOptions, resolved: FieldContext, startMs: number, endMs: number, era?: boolean): boolean;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { epochTwin } from "./islamicEpochEra.js";
|
|
2
|
+
|
|
3
|
+
// src/internal/rangeFieldValues.ts
|
|
4
|
+
/** At most this many cached readers; past it the map clears (a cost of one rebuild each). */
|
|
5
|
+
const MAX_READERS = 256;
|
|
6
|
+
const calendarFields = /* @__PURE__ */ new Map();
|
|
7
|
+
const periodReaders = /* @__PURE__ */ new Map();
|
|
8
|
+
/** Forget the cached readers (the engine's `Intl.DateTimeFormat` was replaced). */
|
|
9
|
+
function forgetFieldReaders() {
|
|
10
|
+
calendarFields.clear();
|
|
11
|
+
periodReaders.clear();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The date and time fields of an instant in a calendar and zone, read from the engine's own
|
|
15
|
+
* calendar data: `era`, `year` (or `relatedYear`), `month`, `day`, `hour` (0 to 23), `minute`,
|
|
16
|
+
* `second`.
|
|
17
|
+
*
|
|
18
|
+
* @example localFieldsOf({ calendar: "gregory", timeZone: "UTC", locale: "en", hourCycle: undefined }, 0)["year"] // "1970"
|
|
19
|
+
*/
|
|
20
|
+
function localFieldsOf(resolved, ms) {
|
|
21
|
+
const key = `${resolved.calendar}|${resolved.timeZone}`;
|
|
22
|
+
let reader = calendarFields.get(key);
|
|
23
|
+
if (reader === void 0) {
|
|
24
|
+
reader = new Intl.DateTimeFormat("en", {
|
|
25
|
+
calendar: resolved.calendar,
|
|
26
|
+
timeZone: resolved.timeZone,
|
|
27
|
+
numberingSystem: "latn",
|
|
28
|
+
era: "short",
|
|
29
|
+
year: "numeric",
|
|
30
|
+
month: "numeric",
|
|
31
|
+
day: "numeric",
|
|
32
|
+
hour: "numeric",
|
|
33
|
+
minute: "numeric",
|
|
34
|
+
second: "numeric",
|
|
35
|
+
hourCycle: "h23"
|
|
36
|
+
});
|
|
37
|
+
if (calendarFields.size >= MAX_READERS) calendarFields.clear();
|
|
38
|
+
calendarFields.set(key, reader);
|
|
39
|
+
}
|
|
40
|
+
const twin = epochTwin(ms, resolved.calendar, resolved.timeZone);
|
|
41
|
+
const fields = {};
|
|
42
|
+
for (const part of reader.formatToParts(twin === null ? ms : twin.ms)) fields[part.type] = (fields[part.type] ?? "") + part.value;
|
|
43
|
+
if (twin !== null) fields["year"] = "1";
|
|
44
|
+
return fields;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The flexible day period the formatter prints for an instant, in its own width, or `""` when its
|
|
48
|
+
* pattern prints none (so no two instants differ in it). The period is a property of the time as
|
|
49
|
+
* the pattern prints it: with minutes, 12:00 is `noon` and 12:25 `in the afternoon`, while an
|
|
50
|
+
* hour-only pattern says `noon` for the whole hour. So the reader carries the caller's own time
|
|
51
|
+
* fields, and no date field (a week-year pattern could make a date field unsafe to read: D23).
|
|
52
|
+
*
|
|
53
|
+
* @example dayPeriodOf({ hour: "numeric", minute: "numeric", dayPeriod: "long" }, { calendar: "gregory", timeZone: "UTC", locale: "en", hourCycle: "h12" }, Date.UTC(2024, 6, 10, 12, 0)) // "noon"
|
|
54
|
+
*/
|
|
55
|
+
function dayPeriodOf(options, resolved, ms) {
|
|
56
|
+
if (options.dayPeriod === void 0) return "";
|
|
57
|
+
const key = `${resolved.locale}|${resolved.calendar}|${resolved.timeZone}|${resolved.hourCycle}|${options.dayPeriod}|${options.hour}|${options.minute}|${options.second}|${options.fractionalSecondDigits}`;
|
|
58
|
+
let reader = periodReaders.get(key);
|
|
59
|
+
if (reader === void 0) {
|
|
60
|
+
const twin = {
|
|
61
|
+
calendar: resolved.calendar,
|
|
62
|
+
timeZone: resolved.timeZone,
|
|
63
|
+
hour: options.hour,
|
|
64
|
+
minute: options.minute,
|
|
65
|
+
second: options.second,
|
|
66
|
+
fractionalSecondDigits: options.fractionalSecondDigits,
|
|
67
|
+
dayPeriod: options.dayPeriod
|
|
68
|
+
};
|
|
69
|
+
if (resolved.hourCycle !== void 0) twin.hourCycle = resolved.hourCycle;
|
|
70
|
+
reader = new Intl.DateTimeFormat(resolved.locale, twin);
|
|
71
|
+
if (periodReaders.size >= MAX_READERS) periodReaders.clear();
|
|
72
|
+
periodReaders.set(key, reader);
|
|
73
|
+
}
|
|
74
|
+
return reader.formatToParts(ms).find((part) => part.type === "dayPeriod")?.value ?? "";
|
|
75
|
+
}
|
|
76
|
+
/** The Table 6 rows of a formatter, in table order (ECMA-402 11.5.8). */
|
|
77
|
+
function rowsOf(options, resolved, era) {
|
|
78
|
+
const dateStyle = options.dateStyle !== void 0;
|
|
79
|
+
const timeStyle = options.timeStyle !== void 0;
|
|
80
|
+
const hour = options.hour !== void 0 || timeStyle;
|
|
81
|
+
const minute = options.minute !== void 0 || options.second !== void 0 || timeStyle;
|
|
82
|
+
const second = options.second !== void 0 || options.fractionalSecondDigits !== void 0 || timeStyle && options.timeStyle !== "short";
|
|
83
|
+
const fsd = options.fractionalSecondDigits;
|
|
84
|
+
const field = (...types) => (ms) => {
|
|
85
|
+
const fields = localFieldsOf(resolved, ms);
|
|
86
|
+
return types.map((type) => fields[type] ?? "").join("|");
|
|
87
|
+
};
|
|
88
|
+
return [
|
|
89
|
+
{
|
|
90
|
+
name: "era",
|
|
91
|
+
printed: era,
|
|
92
|
+
value: field("era")
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "year",
|
|
96
|
+
printed: options.year !== void 0 || dateStyle,
|
|
97
|
+
value: field("year", "relatedYear", "yearName")
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "month",
|
|
101
|
+
printed: options.month !== void 0 || dateStyle,
|
|
102
|
+
value: field("month")
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "day",
|
|
106
|
+
printed: options.day !== void 0 || dateStyle,
|
|
107
|
+
value: field("day")
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "ampm",
|
|
111
|
+
printed: hour,
|
|
112
|
+
value: (ms) => String(Number(localFieldsOf(resolved, ms)["hour"]) < 12)
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "dayperiod",
|
|
116
|
+
printed: hour || options.dayPeriod !== void 0,
|
|
117
|
+
value: (ms) => dayPeriodOf(options, resolved, ms)
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "hour",
|
|
121
|
+
printed: hour,
|
|
122
|
+
value: field("hour")
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "minute",
|
|
126
|
+
printed: minute,
|
|
127
|
+
value: field("minute")
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "second",
|
|
131
|
+
printed: second,
|
|
132
|
+
value: field("second")
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "fractionalsecond",
|
|
136
|
+
printed: fsd !== void 0,
|
|
137
|
+
value: (ms) => String(Math.floor((ms % 1e3 + 1e3) % 1e3 * 10 ** ((fsd ?? 3) - 3)))
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Whether two instants hold equal field values in every Table 6 row ECMA-402
|
|
143
|
+
* PartitionDateTimeRangePattern checks, so the range is the start's single format. A row is
|
|
144
|
+
* checked while no range pattern is selected, and from the first row the pattern prints until the
|
|
145
|
+
* first later row it does not print (`checkMoreFields`): a month-only pattern ignores the day, a
|
|
146
|
+
* pattern with minutes ignores the seconds. Printed text is never compared.
|
|
147
|
+
*
|
|
148
|
+
* @param options the formatter's options
|
|
149
|
+
* @param resolved its resolved calendar, zone, locale and hour cycle
|
|
150
|
+
* @param startMs the start in epoch milliseconds
|
|
151
|
+
* @param endMs the end in epoch milliseconds
|
|
152
|
+
* @param era whether the pattern prints an era (default: the `era` option is set)
|
|
153
|
+
* @returns `true` when the range collapses to the start's single format
|
|
154
|
+
*
|
|
155
|
+
* @example rangeFieldsEqual({ year: "2-digit" }, { calendar: "gregory", timeZone: "UTC", locale: "en", hourCycle: undefined }, Date.UTC(1924, 0, 1), Date.UTC(2024, 0, 1)) // false
|
|
156
|
+
*/
|
|
157
|
+
function rangeFieldsEqual(options, resolved, startMs, endMs, era = options.era !== void 0) {
|
|
158
|
+
let selected = false;
|
|
159
|
+
for (const row of rowsOf(options, resolved, era)) {
|
|
160
|
+
if (selected && !row.printed) return true;
|
|
161
|
+
selected = row.printed;
|
|
162
|
+
if (row.value(startMs) !== row.value(endMs)) return false;
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export { dayPeriodOf, forgetFieldReaders, localFieldsOf, rangeFieldsEqual };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The range text where the engine's range pattern drops, repeats or garbles a field (defect D29)
|
|
3
|
+
* for this pair of instants, or `null` when the engine's own range is right and is to be used.
|
|
4
|
+
*
|
|
5
|
+
* The verdict is per pattern and per class of the greatest field that differs, because an engine's
|
|
6
|
+
* interval data is per class: a pattern wrong for a day-apart range prints a same-day range right,
|
|
7
|
+
* and that range is not replaced. Two instants whose field values are equal in every row ECMA-402
|
|
8
|
+
* PartitionDateTimeRangePattern checks are the one single text; printed text is never compared.
|
|
9
|
+
*
|
|
10
|
+
* @param formatter the formatter whose range is asked for
|
|
11
|
+
* @param options the options it was built with
|
|
12
|
+
* @param startMs the start in epoch milliseconds
|
|
13
|
+
* @param endMs the end in epoch milliseconds
|
|
14
|
+
* @returns the repaired text, `""` when the fallback joiner is unavailable, or `null` to use the engine's range
|
|
15
|
+
*
|
|
16
|
+
* @example rangeFieldsText(new Intl.DateTimeFormat("en", { dateStyle: "medium", timeZone: "UTC" }), { dateStyle: "medium" }, 0, 86_400_000) // null on an engine whose ranges are right
|
|
17
|
+
*/
|
|
18
|
+
export declare function rangeFieldsText(formatter: Intl.DateTimeFormat, options: Intl.DateTimeFormatOptions, startMs: number, endMs: number): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* The range as the locale's fallback writes it from the formatter's own single texts, or `""` when
|
|
21
|
+
* the joiner or a single is unavailable (the house value).
|
|
22
|
+
*
|
|
23
|
+
* @example rangeFromSingles(new Intl.DateTimeFormat("en", { dateStyle: "medium", timeZone: "UTC" }), 1715731200000, 1715904000000) // "May 15, 2024 – May 17, 2024"
|
|
24
|
+
*/
|
|
25
|
+
export declare function rangeFromSingles(formatter: Intl.DateTimeFormat, startMs: number, endMs: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* The text of a range: the fields repair of D29 where this pair needs it, else the year repair
|
|
28
|
+
* (`formatRangeChecked`) of the engine's own range. The one call the range functions make.
|
|
29
|
+
*
|
|
30
|
+
* @returns the text, or `null` when a flagged formatter's year runs cannot be repaired
|
|
31
|
+
*
|
|
32
|
+
* @example formatRangeRepaired(new Intl.DateTimeFormat("en", { dateStyle: "medium", timeZone: "UTC" }), { dateStyle: "medium" }, 1715731200000, 1715904000000) // "May 15 – 17, 2024"
|
|
33
|
+
*/
|
|
34
|
+
export declare function formatRangeRepaired(formatter: Intl.DateTimeFormat, options: Intl.DateTimeFormatOptions, startMs: number, endMs: number): string | null;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { isRangeFieldCompatNeeded } from "./temporalCompat/capabilities.js";
|
|
2
|
+
import { DATE_KEYS, TIME_KEYS, verdictKey } from "./patternKey.js";
|
|
3
|
+
import { rangeVerdict } from "./rangeDetector.js";
|
|
4
|
+
import { dayPeriodOf, forgetFieldReaders, localFieldsOf, rangeFieldsEqual } from "./rangeFieldValues.js";
|
|
5
|
+
import { fallbackTemplate, joinFallback } from "./rangeFallback.js";
|
|
6
|
+
import { formatRangeChecked } from "./weekYearRange.js";
|
|
7
|
+
import { ensureRangeHooks } from "./rangeRepairs.js";
|
|
8
|
+
|
|
9
|
+
// src/internal/rangeFields.ts
|
|
10
|
+
/**
|
|
11
|
+
* At most this many verdicts; past it the whole map clears (one `Map#clear`, then each pattern is
|
|
12
|
+
* judged again on its next range: a cost of one detector run per live pattern, never a wrong text).
|
|
13
|
+
*/
|
|
14
|
+
const MAX_VERDICTS = 256;
|
|
15
|
+
const verdicts = /* @__PURE__ */ new Map();
|
|
16
|
+
let verdictsBuiltWith;
|
|
17
|
+
/** A UTC, zone-free clone of the formatter: the same pattern, with no zone to move an instant. */
|
|
18
|
+
function cloneOf(options, resolved) {
|
|
19
|
+
const twin = {
|
|
20
|
+
calendar: resolved.calendar,
|
|
21
|
+
numberingSystem: resolved.numberingSystem,
|
|
22
|
+
timeZone: "UTC"
|
|
23
|
+
};
|
|
24
|
+
if (resolved.hourCycle !== void 0) twin.hourCycle = resolved.hourCycle;
|
|
25
|
+
if (options.formatMatcher !== void 0) twin.formatMatcher = options.formatMatcher;
|
|
26
|
+
for (const key of [...DATE_KEYS, ...TIME_KEYS]) if (options[key] !== void 0) Object.assign(twin, { [key]: options[key] });
|
|
27
|
+
return new Intl.DateTimeFormat(resolved.locale, twin);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The class of the greatest field that differs between two instants in the formatter's calendar and
|
|
31
|
+
* zone, named as the detector's probes are: `G` era, `y` year, `M` month, `d` day, `a` AM or PM,
|
|
32
|
+
* `B` flexible day period, `h` hour, `m` minute; `null` when only seconds or less differ. The order
|
|
33
|
+
* is ECMA-402 Table 6.
|
|
34
|
+
*/
|
|
35
|
+
function greatestClass(options, resolved, startMs, endMs) {
|
|
36
|
+
const x = localFieldsOf(resolved, startMs);
|
|
37
|
+
const y = localFieldsOf(resolved, endMs);
|
|
38
|
+
const differs = (...types) => types.some((type) => x[type] !== y[type]);
|
|
39
|
+
if (differs("era")) return "G";
|
|
40
|
+
if (differs("year", "relatedYear", "yearName")) return "y";
|
|
41
|
+
if (differs("month")) return "M";
|
|
42
|
+
if (differs("day")) return "d";
|
|
43
|
+
if (Math.floor(Number(x["hour"]) / 12) !== Math.floor(Number(y["hour"]) / 12)) return "a";
|
|
44
|
+
if (dayPeriodOf(options, resolved, startMs) !== dayPeriodOf(options, resolved, endMs)) return "B";
|
|
45
|
+
if (differs("hour")) return "h";
|
|
46
|
+
return differs("minute") ? "m" : null;
|
|
47
|
+
}
|
|
48
|
+
/** The classes of range this formatter's pattern gets wrong, kept per pattern. */
|
|
49
|
+
function wrongClasses(options, resolved) {
|
|
50
|
+
if (verdictsBuiltWith !== Intl.DateTimeFormat) {
|
|
51
|
+
verdicts.clear();
|
|
52
|
+
forgetFieldReaders();
|
|
53
|
+
verdictsBuiltWith = Intl.DateTimeFormat;
|
|
54
|
+
}
|
|
55
|
+
const key = verdictKey(options, resolved);
|
|
56
|
+
const known = verdicts.get(key);
|
|
57
|
+
if (known !== void 0) return known;
|
|
58
|
+
const clone = cloneOf(options, resolved);
|
|
59
|
+
const { classes } = rangeVerdict({
|
|
60
|
+
format: (ms) => clone.format(ms),
|
|
61
|
+
formatRange: (a, b) => clone.formatRange(a, b),
|
|
62
|
+
...options.dayPeriod === void 0 ? {} : { dayPeriod: (ms) => dayPeriodOf(options, {
|
|
63
|
+
...resolved,
|
|
64
|
+
timeZone: "UTC"
|
|
65
|
+
}, ms) }
|
|
66
|
+
}, resolved.calendar);
|
|
67
|
+
if (verdicts.size >= MAX_VERDICTS) verdicts.clear();
|
|
68
|
+
verdicts.set(key, classes);
|
|
69
|
+
return classes;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The range text where the engine's range pattern drops, repeats or garbles a field (defect D29)
|
|
73
|
+
* for this pair of instants, or `null` when the engine's own range is right and is to be used.
|
|
74
|
+
*
|
|
75
|
+
* The verdict is per pattern and per class of the greatest field that differs, because an engine's
|
|
76
|
+
* interval data is per class: a pattern wrong for a day-apart range prints a same-day range right,
|
|
77
|
+
* and that range is not replaced. Two instants whose field values are equal in every row ECMA-402
|
|
78
|
+
* PartitionDateTimeRangePattern checks are the one single text; printed text is never compared.
|
|
79
|
+
*
|
|
80
|
+
* @param formatter the formatter whose range is asked for
|
|
81
|
+
* @param options the options it was built with
|
|
82
|
+
* @param startMs the start in epoch milliseconds
|
|
83
|
+
* @param endMs the end in epoch milliseconds
|
|
84
|
+
* @returns the repaired text, `""` when the fallback joiner is unavailable, or `null` to use the engine's range
|
|
85
|
+
*
|
|
86
|
+
* @example rangeFieldsText(new Intl.DateTimeFormat("en", { dateStyle: "medium", timeZone: "UTC" }), { dateStyle: "medium" }, 0, 86_400_000) // null on an engine whose ranges are right
|
|
87
|
+
*/
|
|
88
|
+
function rangeFieldsText(formatter, options, startMs, endMs) {
|
|
89
|
+
if (!isRangeFieldCompatNeeded()) return null;
|
|
90
|
+
try {
|
|
91
|
+
const resolved = formatter.resolvedOptions();
|
|
92
|
+
const classes = wrongClasses(options, resolved);
|
|
93
|
+
if (!classes.length) return null;
|
|
94
|
+
if (rangeFieldsEqual(options, resolved, startMs, endMs)) return formatter.format(startMs);
|
|
95
|
+
return classes.includes(greatestClass(options, resolved, startMs, endMs) ?? "") ? rangeFromSingles(formatter, startMs, endMs) : null;
|
|
96
|
+
} catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The range as the locale's fallback writes it from the formatter's own single texts, or `""` when
|
|
102
|
+
* the joiner or a single is unavailable (the house value).
|
|
103
|
+
*
|
|
104
|
+
* @example rangeFromSingles(new Intl.DateTimeFormat("en", { dateStyle: "medium", timeZone: "UTC" }), 1715731200000, 1715904000000) // "May 15, 2024 – May 17, 2024"
|
|
105
|
+
*/
|
|
106
|
+
function rangeFromSingles(formatter, startMs, endMs) {
|
|
107
|
+
try {
|
|
108
|
+
const { locale, numberingSystem, calendar } = formatter.resolvedOptions();
|
|
109
|
+
const template = fallbackTemplate(locale, numberingSystem, calendar);
|
|
110
|
+
const first = formatter.format(startMs);
|
|
111
|
+
const last = formatter.format(endMs);
|
|
112
|
+
return template === null || first === "" || last === "" ? "" : joinFallback(template, first, last);
|
|
113
|
+
} catch {
|
|
114
|
+
return "";
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The text of a range: the fields repair of D29 where this pair needs it, else the year repair
|
|
119
|
+
* (`formatRangeChecked`) of the engine's own range. The one call the range functions make.
|
|
120
|
+
*
|
|
121
|
+
* @returns the text, or `null` when a flagged formatter's year runs cannot be repaired
|
|
122
|
+
*
|
|
123
|
+
* @example formatRangeRepaired(new Intl.DateTimeFormat("en", { dateStyle: "medium", timeZone: "UTC" }), { dateStyle: "medium" }, 1715731200000, 1715904000000) // "May 15 – 17, 2024"
|
|
124
|
+
*/
|
|
125
|
+
function formatRangeRepaired(formatter, options, startMs, endMs) {
|
|
126
|
+
ensureRangeHooks();
|
|
127
|
+
return rangeFieldsText(formatter, options, startMs, endMs) ?? formatRangeChecked(formatter, options, startMs, endMs);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export { formatRangeRepaired, rangeFieldsText, rangeFromSingles };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** The state `yearPrinting.ts` hands to the range repair of a wrapped formatter. */
|
|
2
|
+
export interface YearRangeContext {
|
|
3
|
+
/** The formatter the wrapper stands in for. */
|
|
4
|
+
readonly formatter: Intl.DateTimeFormat;
|
|
5
|
+
/** The options it was built with. */
|
|
6
|
+
readonly options: Intl.DateTimeFormatOptions;
|
|
7
|
+
/** Its resolved options. */
|
|
8
|
+
readonly resolved: Intl.ResolvedDateTimeFormatOptions;
|
|
9
|
+
/** The Gregorian twin used for dates before the first Japanese era (D25). */
|
|
10
|
+
readonly twin: () => Intl.DateTimeFormat;
|
|
11
|
+
/** The Gregorian era name of a date before 1873 (`AD`), or `null` when none applies. */
|
|
12
|
+
readonly eraNameOf: (ms: number) => string | null;
|
|
13
|
+
/**
|
|
14
|
+
* The engine's japanese era names of an instant from 1873 on, longest first (`Shōwa`, `S`): a
|
|
15
|
+
* range pattern may write an era in another width than the single pattern does.
|
|
16
|
+
*/
|
|
17
|
+
readonly japaneseEraNames: (ms: number) => string[];
|
|
18
|
+
/** The twin's text of a date before 1873, with the Gregorian era written where the pattern puts it. */
|
|
19
|
+
readonly twinText: (ms: number) => string;
|
|
20
|
+
/** Whether the pattern prints an era (D25 is on for this formatter). */
|
|
21
|
+
readonly eraSeat: boolean;
|
|
22
|
+
/** Whether the options use `dateStyle` or `timeStyle`. */
|
|
23
|
+
readonly styled: boolean;
|
|
24
|
+
/** Whether D27 pads the era year of this formatter. */
|
|
25
|
+
readonly pad: boolean;
|
|
26
|
+
/** The formatter's own single text of an instant, repaired. */
|
|
27
|
+
readonly single: (ms: number) => string;
|
|
28
|
+
/** The zero of the formatter's numbering system. */
|
|
29
|
+
readonly zero: string;
|
|
30
|
+
/** The digits of the formatter's numbering system. */
|
|
31
|
+
readonly digitSet: ReadonlySet<string>;
|
|
32
|
+
/** The instants shifted by whole years that keep date and time, or `null`. */
|
|
33
|
+
readonly shiftOf: (ms: number) => number | null;
|
|
34
|
+
}
|
|
35
|
+
/** What `rangeRepairs.ts` installs. */
|
|
36
|
+
export interface RangeHooks {
|
|
37
|
+
/** The engine's range text with the week-year repaired (`formatRangeChecked`). */
|
|
38
|
+
readonly checked: (formatter: Intl.DateTimeFormat, options: Intl.DateTimeFormatOptions, startMs: number, endMs: number) => string | null;
|
|
39
|
+
/** The range of a formatter D25 or D27 wraps; `before` says which ends precede 1873. */
|
|
40
|
+
readonly yearRange: (context: YearRangeContext, startMs: number, endMs: number, before: readonly [boolean, boolean]) => string | null;
|
|
41
|
+
/** The range modules' own caches, forgotten with the formatters. */
|
|
42
|
+
readonly forget: readonly (() => void)[];
|
|
43
|
+
}
|
|
44
|
+
/** Install the range repairs (called once, by `ensureRangeHooks` in `rangeRepairs.ts`). */
|
|
45
|
+
export declare function registerRangeHooks(hooks: RangeHooks): void;
|
|
46
|
+
/** The installed range repairs, or `undefined` in a bundle that formats no range. */
|
|
47
|
+
export declare function rangeHooks(): RangeHooks | undefined;
|
|
48
|
+
/** Record a stand-in whose `formatRange` is the installed `checked` already. */
|
|
49
|
+
export declare function markRangeHandled(standIn: object): void;
|
|
50
|
+
/** Whether the stand-in repairs its own range. */
|
|
51
|
+
export declare function isRangeHandled(formatter: object): boolean;
|
|
52
|
+
/** Forget the range modules' caches, when any are installed. */
|
|
53
|
+
export declare function forgetRanges(): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/internal/rangeHooks.ts
|
|
2
|
+
let installed;
|
|
3
|
+
/** Stand-ins whose own `formatRange` already repairs the year. */
|
|
4
|
+
const handled = /* @__PURE__ */ new WeakSet();
|
|
5
|
+
/** Install the range repairs (called once, by `ensureRangeHooks` in `rangeRepairs.ts`). */
|
|
6
|
+
function registerRangeHooks(hooks) {
|
|
7
|
+
installed = hooks;
|
|
8
|
+
}
|
|
9
|
+
/** The installed range repairs, or `undefined` in a bundle that formats no range. */
|
|
10
|
+
function rangeHooks() {
|
|
11
|
+
return installed;
|
|
12
|
+
}
|
|
13
|
+
/** Record a stand-in whose `formatRange` is the installed `checked` already. */
|
|
14
|
+
function markRangeHandled(standIn) {
|
|
15
|
+
handled.add(standIn);
|
|
16
|
+
}
|
|
17
|
+
/** Whether the stand-in repairs its own range. */
|
|
18
|
+
function isRangeHandled(formatter) {
|
|
19
|
+
return handled.has(formatter);
|
|
20
|
+
}
|
|
21
|
+
/** Forget the range modules' caches, when any are installed. */
|
|
22
|
+
function forgetRanges() {
|
|
23
|
+
for (const forget of installed?.forget ?? []) forget();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { forgetRanges, isRangeHandled, markRangeHandled, rangeHooks, registerRangeHooks };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { rangeHooks, registerRangeHooks } from "./rangeHooks.js";
|
|
2
|
+
import { forgetFallbackTemplates } from "./rangeFallback.js";
|
|
3
|
+
import { forgetWeekYearRange, formatRangeChecked } from "./weekYearRange.js";
|
|
4
|
+
import { yearRangeText } from "./yearPrintingRange.js";
|
|
5
|
+
|
|
6
|
+
// src/internal/rangeRepairs.ts
|
|
7
|
+
/** Install the range repairs once; a second call changes nothing. */
|
|
8
|
+
function ensureRangeHooks() {
|
|
9
|
+
if (rangeHooks() === void 0) registerRangeHooks({
|
|
10
|
+
checked: formatRangeChecked,
|
|
11
|
+
yearRange: yearRangeText,
|
|
12
|
+
forget: [forgetWeekYearRange, forgetFallbackTemplates]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { ensureRangeHooks, formatRangeChecked };
|
|
@@ -5,12 +5,10 @@
|
|
|
5
5
|
* otherwise read each one several times, and a getter could answer one value to the check and
|
|
6
6
|
* another to the formatter. ECMA-402 CreateDateTimeFormat reads each option with one `Get`
|
|
7
7
|
* (GetOption); this does the same, in the same order, and everything after works on the copy.
|
|
8
|
-
* - Each value is
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* and the allowed values are still checked by `Intl.DateTimeFormat`. `timeZone` alone is copied
|
|
13
|
-
* unconverted, for the caller's own zone rule.
|
|
8
|
+
* - Each value is checked once, right after its `Get`, and never converted: a string option must be a string, `fractionalSecondDigits` a number and `hour12` a boolean; any
|
|
9
|
+
* other value throws `TypeError` and nothing is converted. The range and the allowed values are
|
|
10
|
+
* still checked by `Intl.DateTimeFormat`. `timeZone` alone is copied unchecked, for the
|
|
11
|
+
* caller's own zone rule.
|
|
14
12
|
* - The object is coerced as ECMA-402 CoerceOptionsToObject coerces it: `undefined` is no options,
|
|
15
13
|
* `null` throws TypeError, and a string or a number has none of these properties. Inherited
|
|
16
14
|
* properties are read, as `Get` reads them.
|
|
@@ -18,11 +16,11 @@
|
|
|
18
16
|
* `undefined`. Any other key was never read by the formatter, so dropping it changes nothing.
|
|
19
17
|
*
|
|
20
18
|
* @param options the caller's options argument
|
|
21
|
-
* @returns a plain object holding each option that was set
|
|
22
|
-
*
|
|
19
|
+
* @returns a plain object holding each option that was set; throws TypeError for `null`, or for
|
|
20
|
+
* a value of the wrong type, for the caller's sentinel
|
|
23
21
|
*
|
|
24
22
|
* @example readDateTimeFormatOptions({ dateStyle: "long", extra: 1 }) // { dateStyle: "long" }
|
|
25
|
-
* @example readDateTimeFormatOptions({ month: { toString: () => "long" } }) //
|
|
23
|
+
* @example readDateTimeFormatOptions({ month: { toString: () => "long" } }) // throws TypeError
|
|
26
24
|
* @example readDateTimeFormatOptions(undefined) // {}
|
|
27
25
|
* @example readDateTimeFormatOptions("x") // {} (a string has no date-time options)
|
|
28
26
|
* @example readDateTimeFormatOptions(null) // throws TypeError
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isIntlOptionValue } from "./typedOptions.js";
|
|
2
|
+
|
|
1
3
|
// src/internal/readDateTimeFormatOptions.ts
|
|
2
4
|
/**
|
|
3
5
|
* The options ECMA-402 CreateDateTimeFormat reads, in the order it reads them: the formatter's own
|
|
@@ -26,21 +28,16 @@ const DATE_TIME_FORMAT_OPTIONS = [
|
|
|
26
28
|
"timeStyle"
|
|
27
29
|
];
|
|
28
30
|
/**
|
|
29
|
-
*
|
|
30
|
-
* for `hour12`,
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* bigint for a number) throws TypeError as it does inside `Intl.DateTimeFormat`.
|
|
31
|
+
* An option's value, which must already have the type `Intl.DateTimeFormat` declares for it:
|
|
32
|
+
* `boolean` for `hour12`, `number` for `fractionalSecondDigits`, `string` for every other option.
|
|
33
|
+
* ECMA-402 GetOption would convert any other value (ToString, ToNumber, ToBoolean), but a
|
|
34
|
+
* function accepts exactly the declared types, so anything else throws `TypeError` and the caller
|
|
35
|
+
* returns its sentinel. `timeZone` is returned as it was read: each caller has its own rule for
|
|
36
|
+
* a zone, and one that hands it to `Intl.DateTimeFormat` does so once.
|
|
36
37
|
*/
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
case "hour12": return Boolean(value);
|
|
41
|
-
case "fractionalSecondDigits": return +value;
|
|
42
|
-
default: return `${value}`;
|
|
43
|
-
}
|
|
38
|
+
function typedOption(name, value) {
|
|
39
|
+
if (name !== "timeZone" && !isIntlOptionValue(name, value)) throw new TypeError(`option ${name} has the wrong type`);
|
|
40
|
+
return value;
|
|
44
41
|
}
|
|
45
42
|
/**
|
|
46
43
|
* Read a caller's `Intl.DateTimeFormat` options once, into a plain object of primitives.
|
|
@@ -49,12 +46,10 @@ function convertOption(name, value) {
|
|
|
49
46
|
* otherwise read each one several times, and a getter could answer one value to the check and
|
|
50
47
|
* another to the formatter. ECMA-402 CreateDateTimeFormat reads each option with one `Get`
|
|
51
48
|
* (GetOption); this does the same, in the same order, and everything after works on the copy.
|
|
52
|
-
* - Each value is
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* and the allowed values are still checked by `Intl.DateTimeFormat`. `timeZone` alone is copied
|
|
57
|
-
* unconverted, for the caller's own zone rule.
|
|
49
|
+
* - Each value is checked once, right after its `Get`, and never converted: a string option must be a string, `fractionalSecondDigits` a number and `hour12` a boolean; any
|
|
50
|
+
* other value throws `TypeError` and nothing is converted. The range and the allowed values are
|
|
51
|
+
* still checked by `Intl.DateTimeFormat`. `timeZone` alone is copied unchecked, for the
|
|
52
|
+
* caller's own zone rule.
|
|
58
53
|
* - The object is coerced as ECMA-402 CoerceOptionsToObject coerces it: `undefined` is no options,
|
|
59
54
|
* `null` throws TypeError, and a string or a number has none of these properties. Inherited
|
|
60
55
|
* properties are read, as `Get` reads them.
|
|
@@ -62,11 +57,11 @@ function convertOption(name, value) {
|
|
|
62
57
|
* `undefined`. Any other key was never read by the formatter, so dropping it changes nothing.
|
|
63
58
|
*
|
|
64
59
|
* @param options the caller's options argument
|
|
65
|
-
* @returns a plain object holding each option that was set
|
|
66
|
-
*
|
|
60
|
+
* @returns a plain object holding each option that was set; throws TypeError for `null`, or for
|
|
61
|
+
* a value of the wrong type, for the caller's sentinel
|
|
67
62
|
*
|
|
68
63
|
* @example readDateTimeFormatOptions({ dateStyle: "long", extra: 1 }) // { dateStyle: "long" }
|
|
69
|
-
* @example readDateTimeFormatOptions({ month: { toString: () => "long" } }) //
|
|
64
|
+
* @example readDateTimeFormatOptions({ month: { toString: () => "long" } }) // throws TypeError
|
|
70
65
|
* @example readDateTimeFormatOptions(undefined) // {}
|
|
71
66
|
* @example readDateTimeFormatOptions("x") // {} (a string has no date-time options)
|
|
72
67
|
* @example readDateTimeFormatOptions(null) // throws TypeError
|
|
@@ -78,7 +73,7 @@ function readDateTimeFormatOptions(options) {
|
|
|
78
73
|
const source = Object(options);
|
|
79
74
|
for (const name of DATE_TIME_FORMAT_OPTIONS) {
|
|
80
75
|
const value = source[name];
|
|
81
|
-
if (value !== void 0) read[name] =
|
|
76
|
+
if (value !== void 0) read[name] = typedOption(name, value);
|
|
82
77
|
}
|
|
83
78
|
return read;
|
|
84
79
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Temporal } from "./temporal.js";
|
|
2
|
+
import { Overflow } from "../types/overflow.js";
|
|
3
|
+
import "../types/index.js";
|
|
1
4
|
/** The date fields `setDate` takes. */
|
|
2
5
|
export declare const DATE_FIELDS: readonly ["year", "month", "monthCode", "day"];
|
|
3
6
|
/** The time fields `setTime` takes. */
|
|
@@ -45,4 +48,48 @@ export type SetFields<Field extends SetField> = { [Name in Field]?: Name extends
|
|
|
45
48
|
* @example readSetFields({ year: 2025, hour: 5 }, DATE_FIELDS) // null (a field setDate does not take)
|
|
46
49
|
*/
|
|
47
50
|
export declare function readSetFields<Field extends SetField>(fields: unknown, allowedFields: readonly Field[]): SetFields<Field> | null;
|
|
51
|
+
/**
|
|
52
|
+
* The `setDate` core: a `PlainDate` with the checked `fields` set.
|
|
53
|
+
*
|
|
54
|
+
* Only values `readSetFields` checked reach Temporal. An empty set changes nothing, where
|
|
55
|
+
* Temporal's `with()` would throw. May throw where Temporal does; each caller maps that to its
|
|
56
|
+
* sentinel.
|
|
57
|
+
*
|
|
58
|
+
* @param date the date to change
|
|
59
|
+
* @param fields the caller's `fields` argument
|
|
60
|
+
* @param overflow Temporal `overflow`, or a function that reads it; the function runs only once `fields` is
|
|
61
|
+
* valid and not empty, so an option that throws is never read for a value that does not need it
|
|
62
|
+
* @returns the changed date, or `null` when `fields` is invalid
|
|
63
|
+
*
|
|
64
|
+
* @example withDateFields(Temporal.PlainDate.from("2024-03-10"), { day: 15 }, "constrain")?.toString() // "2024-03-15"
|
|
65
|
+
*/
|
|
66
|
+
export declare function withDateFields(date: Temporal.PlainDate, fields: unknown, overflow: Overflow | (() => Overflow)): Temporal.PlainDate | null;
|
|
67
|
+
/**
|
|
68
|
+
* The `setDateTime` core: a `PlainDateTime` with the checked `fields` set.
|
|
69
|
+
*
|
|
70
|
+
* May throw where Temporal does; each caller maps that to its sentinel.
|
|
71
|
+
*
|
|
72
|
+
* @param dateTime the date-time to change
|
|
73
|
+
* @param fields the caller's `fields` argument
|
|
74
|
+
* @param overflow Temporal `overflow`, or a function that reads it; the function runs only once `fields` is
|
|
75
|
+
* valid and not empty, so an option that throws is never read for a value that does not need it
|
|
76
|
+
* @returns the changed date-time, or `null` when `fields` is invalid
|
|
77
|
+
*
|
|
78
|
+
* @example withDateTimeFields(Temporal.PlainDateTime.from("2024-03-10T08:00"), { hour: 9 }, "constrain")?.toString() // "2024-03-10T09:00:00"
|
|
79
|
+
*/
|
|
80
|
+
export declare function withDateTimeFields(dateTime: Temporal.PlainDateTime, fields: unknown, overflow: Overflow | (() => Overflow)): Temporal.PlainDateTime | null;
|
|
81
|
+
/**
|
|
82
|
+
* The `setTime` core: a `PlainTime` with the checked `fields` set.
|
|
83
|
+
*
|
|
84
|
+
* May throw where Temporal does; each caller maps that to its sentinel.
|
|
85
|
+
*
|
|
86
|
+
* @param time the time to change
|
|
87
|
+
* @param fields the caller's `fields` argument
|
|
88
|
+
* @param overflow Temporal `overflow`, or a function that reads it; the function runs only once `fields` is
|
|
89
|
+
* valid and not empty, so an option that throws is never read for a value that does not need it
|
|
90
|
+
* @returns the changed time, or `null` when `fields` is invalid
|
|
91
|
+
*
|
|
92
|
+
* @example withTimeFields(Temporal.PlainTime.from("08:00"), { minute: 30 }, "constrain")?.toString() // "08:30:00"
|
|
93
|
+
*/
|
|
94
|
+
export declare function withTimeFields(time: Temporal.PlainTime, fields: unknown, overflow: Overflow | (() => Overflow)): Temporal.PlainTime | null;
|
|
48
95
|
export {};
|