Skip to main content

Arrow JS temporal mapping

🧪 Experimental — The @math.gl/earth/celestial subpath and all its exported functions, classes, constants, and types are experimental.

This is a semantic mapping, not a claim that every JavaScript object supports every Arrow int64 value. Check range, precision and conversion policy separately. Getter behavior was checked against installed Arrow JS 21.2.0 and the current Arrow JS source on October 23, 2026. Arrow remains an optional interoperability boundary; celestial has no Arrow dependency.

Five distinct concepts​

ConceptMeaningExisting JavaScript / Cesium representationPossible math.gl representation
Civil dateA calendar date without time or zoneTemporal.PlainDate; Date needs an explicit midnight conventionProposed EpochDay or civil-date record
Time of dayClock reading without a date or zoneTemporal.PlainTimeProposed TimeOfDay tick count
InstantA physical point on a declared time scaleTemporal.Instant / ZonedDateTime for Unix time; Cesium JulianDate for astronomical TAI arithmeticImplemented celestial JulianDate; proposed exact TickInstant for integer-preserving interchange
Fixed durationAn elapsed quantity, without an epochTime-only Temporal.Duration; numeric seconds for approximate calculationsProposed FixedDuration {ticks: bigint, unit} or split JulianDuration
Calendar intervalMonths/days/time applied relative to a calendar contextTemporal.Duration, subject to sign/range rules and relativeTo contextProposed CalendarInterval {months, days, nanoseconds} preserving independent fields

JulianDate is an instant/time-coordinate representation. A duration is not a Julian date, and a civil date or clock reading cannot become an instant without an interpretation. The new math.gl class accepts explicit TAI, TT and UT1 coordinates; Cesium's class stores TAI internally. Julian day numbering is an astronomical coordinate, not the Julian calendar.

Dates and times of day​

Arrow JS typePhysical storage / semanticsJS scalar getterNatural existing mappingProposed exact representation / Julian mapping
DateDayint32 days since 1970-01-01number, epoch millisecondsTemporal.PlainDate within range; Date at UTC midnight by conventionEpochDay {days: number}. For a Julian instant, choose a time of day, zone and scale conversion.
DateMillisecondint64 epoch milliseconds, constrained to whole-day multiplesnumber, epoch millisecondsSame civil-date meaning as DateDayBigint day count after exact division by 86400000. It is not a general timestamp type.
TimeSecondint32 seconds since midnightnumber in secondsTemporal.PlainTimeTimeOfDay {ticks, unit:'s'}; date and zone needed for an instant.
TimeMillisecondint32 milliseconds since midnightnumber in millisecondsTemporal.PlainTimeSame, unit 'ms'.
TimeMicrosecondint64 microseconds since midnightbigint in microsecondsTemporal.PlainTime after exact field decompositionSame, unit 'us'; conversion to nanoseconds uses bigint multiplication.
TimeNanosecondint64 nanoseconds since midnightbigint in nanosecondsTemporal.PlainTime after exact field decompositionSame, unit 'ns'.

Arrow time-of-day values are in [00:00, 24:00), with no leap-second label. Valid nanoseconds since midnight are below 2^53, so they can also be stored as exact number-valued integers after range validation, even though Arrow JS returns bigint. An Arrow TimeNanosecond is not an epoch timestamp despite having 64-bit storage. Date64 values must be whole-day multiples; do not treat their physical millisecond encoding as arbitrary time. Arrow schema

Timestamps: unit and timezone are separate decisions​

All four types store signed int64 ticks. Arrow JS timestamp scalar getters return number-valued epoch milliseconds, including fractional milliseconds for micro/nanosecond types. Preserve raw bigint ticks to retain the full encoded precision. Arrow JS types, get visitor

Arrow JS typeRaw tick unitExisting exact-integer mappingJulian / proposed mapping
TimestampSecondsecondsWith timezone: Temporal.Instant.fromEpochNanoseconds(ticks * 1000000000n), subject to rangeJulianDate.fromUnixTicks(ticks, 's', scaleMinusUtc, scale) for known physical instants; proposed TickInstant preserves all ticks.
TimestampMillisecondmillisecondsWith timezone: Temporal.Instant from ticks * 1000000n; Date within its rangeSame, unit 'ms'. A raw int64 millisecond value is not always an exact JS number.
TimestampMicrosecondmicrosecondsWith timezone: Temporal.Instant from ticks * 1000n, subject to rangeSame, unit 'us'; avoid number-valued getters for a lossless conversion path.
TimestampNanosecondnanosecondsWith timezone: Temporal.Instant.fromEpochNanoseconds(ticks), subject to rangeSame, unit 'ns'. Integer storage is exact; the Julian seconds field is binary64 and export rounding must be explicit.
Arrow timezone annotationMeaningExisting mappingConversion condition
'UTC'Unix-epoch physical instant; leap seconds omittedTemporal.Instant, or Date with millisecond limitsTo TAI/TT/UT1, provide the appropriate scale-minus-UTC offset at that instant.
Nonempty valid IANA/fixed-offset zoneSame physical epoch ticks plus zone metadataTemporal.Instant plus zone, or Temporal.ZonedDateTimePreserve the zone separately if it cannot be interpreted by the target. Changing between nonempty zones does not shift raw epoch ticks.
Empty / missingWall-clock date/time in an unspecified zoneTemporal.PlainDateTime, within rangeA zone and DST ambiguity policy are needed before choosing a physical instant. Never silently assume UTC.

Timezone metadata does not select TAI, TT or UT1. Standard Arrow timestamps and Temporal.Instant both omit leap seconds. TAI ticks should not be labeled as ordinary UTC Arrow timestamps. Use a custom extension/struct or int64-plus-metadata representation with explicit epoch, scale and unit. Arrow timestamp semantics, Temporal.Instant

Fixed durations​

Every Arrow duration uses signed int64 storage and Arrow JS returns bigint ticks.

Arrow JS typeExact fixed-length mappingExisting JS mappingJulian-style mapping
DurationSecond{ticks, unit:'s'}; nanoseconds = ticks × 1000000000nTime-only Temporal.Duration after integer decomposition, within rangeProposed JulianDuration, or add seconds to a Julian instant when the number conversion is safe.
DurationMillisecond{ticks, unit:'ms'}; nanoseconds = ticks × 1000000nSame, within range; numeric milliseconds only when precision permitsSplit whole days and fractional seconds before using floating-point arithmetic.
DurationMicrosecond{ticks, unit:'us'}; nanoseconds = ticks × 1000nSame, within rangeSame split representation; decimal fractions are not generally exact binary64 values.
DurationNanosecond{ticks, unit:'ns'}Same, within rangeSame; round-trip tick recovery needs an explicit rounding rule.

Fixed duration has no epoch or timezone. Convert units with bigint before narrowing to number. Dividing by a coarser unit can require rounding; multiplying can overflow an Arrow int64 even though a JavaScript bigint remains exact. Arrow permits subtracting Unix timestamps without accounting for inserted leap seconds; that result can differ from true elapsed SI time. Continuous TAI arithmetic requires a correct mapping of both endpoints. Arrow duration semantics

Calendar intervals​

Arrow JS typeRaw fieldsExisting JS mappingRecommended hypothetical mapping
IntervalYearMonthint32 total monthsTemporal.Duration({months}), within its rangeCalendarInterval {months, days:0, nanoseconds:0n}.
IntervalDayTimeint32 days + int32 millisecondsTemporal.Duration retaining days and time separately, when signs/range permitCalendarInterval {months:0, days, nanoseconds:BigInt(milliseconds)*1000000n}.
IntervalMonthDayNanoint32 months + int32 days + int64 nanosecondsConditional Temporal.Duration; not a direct mapping for mixed-sign fieldsPreserve {months, days, nanoseconds} independently. Do not flatten months/days to fixed seconds without calendar/zone context.

Arrow permits independent signs and unnormalized nanoseconds in month/day/nano intervals. Temporal.Duration requires consistent signs. Normalizing a mixed-sign calendar interval may need an anchor date, calendar, timezone and application policy. Preserve its raw components when that context is absent. A calendar day can differ from 86400 elapsed seconds at a DST transition. These types do not map directly to JulianDate or an unanchored fixed duration. Arrow intervals, Temporal.Duration

Arrow JS's year/month getter exposes an Int32 pair of years/months; its day/time getter exposes an Int32 pair of days/milliseconds. The month/day/nano getter exposes four Int32 words; decode the final signed 64-bit nanosecond field with correct word order/endianness, view offset and chunk handling, rather than treating those words as four semantic fields. Getter implementation

Precision, range and adapter rules​

  • Raw int64 nanosecond timestamps span approximately 1677–2262; microseconds span about ±292,000 years about the epoch. Coarser Arrow timestamps have wider ranges. Temporal and Date have separate limits, so test the target range even when Arrow storage is valid.
  • A split day/seconds representation keeps fractional seconds small. Around 86400 seconds, binary64 spacing is approximately 14.6 picoseconds. This is representation spacing, not a model accuracy claim, and arithmetic/scale conversion still rounds.
  • At October 23, 2026, number-valued epoch milliseconds have approximately 244 ns spacing. A local Arrow JS 21.2.0 check of raw timestamps differing by 1 ns returned equal values through vector.get(), while the bigint buffer retained the difference.
  • Preserve Arrow nulls via its validity bitmap. Zero is a valid time/duration, not a null sentinel. Respect chunks, view offsets, units and timezone metadata.
  • A future Arrow adapter belongs at the optional GeoArrow boundary, while celestial exposes dependency-free scalar bigint conversion. The proposed date/time/duration/interval record types above are design candidates, not newly shipped APIs or Arrow extension standards.