Skip to content

toJulianDate

  • The core functions, which every industry uses.
toJulianDate(isoString: string, scale?: TimeScale): number | null

Convert a UTC instant to a single Julian Date on a time scale. The scale defaults to "UTC".

  • A single double resolves a Julian Date only to about 40 µs (2⁻³¹ day) for dates from 1972 to 6771, so any one value can be up to 20 µs off; after 6771, 80 µs and 40 µs. Use toJulianDateParts for nanosecond precision, or toModifiedJulianDate, which keeps about 64 times more digits for dates before 2038.
  • JD days begin at noon (IAU 1997 B1 App. 2): midnight UTC is .5. The result is the exact Julian Date rounded once to the nearest double, ties to even, so it can differ by one ulp from jd1 + jd2 of the parts toJulianDateParts writes, which rounds twice.
  • On "UTC" the count is ERFA’s quasi-JD, the same as toJulianDateParts: a leap-second day counts as one day. On "TAI", "TT" and "TCG" it is a true JD. TDB is not available.
  • Accepts any offset or bracketed zone, and a listed leap second …T23:59:60Z.
  • Domain: 1972-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z UTC; null outside it. Within half a double’s spacing of 1972-01-01 (on TAI and TT; at most about 20 µs, measured 6.1 µs on TAI and 19.8 µs on TT) or of the end of 9999 (on UTC, TAI and TT; at most about 40 µs) it also returns null, because the nearest double lies outside the domain and fromJulianDate would reject it; toJulianDateParts covers the whole domain exactly.
ParameterTypeDescription
isoStringstringISO 8601 instant string
scaleTimeScalethe time scale to count on, default "UTC"

the Julian Date, or null on invalid input, an unknown scale or an instant outside the domain

import { toJulianDate } from "@northguild/gmt/timescale/convert";
toJulianDate("2000-01-01T12:00:00Z") // 2451545
output 

timescale/convert/toJulianDate.ts

© 2026 NorthGuild · Licences

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.