toJulianDate
Signature
Section titled “Signature”toJulianDate(isoString: string, scale?: TimeScale): number | nullConvert 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
toJulianDatePartsfor nanosecond precision, ortoModifiedJulianDate, 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 fromjd1 + jd2of the partstoJulianDatePartswrites, which rounds twice. - On
"UTC"the count is ERFA’s quasi-JD, the same astoJulianDateParts: 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;
nulloutside 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 returnsnull, because the nearest double lies outside the domain andfromJulianDatewould reject it;toJulianDatePartscovers the whole domain exactly.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
isoString | string | ISO 8601 instant string |
scale | TimeScale | the time scale to count on, default "UTC" |
Returns
Section titled “Returns”the Julian Date, or null on invalid input, an unknown scale or an instant outside the domain
Related types
Section titled “Related types”Examples
Section titled “Examples”import { toJulianDate } from "@northguild/gmt/timescale/convert";
toJulianDate("2000-01-01T12:00:00Z") // 2451545Source
Section titled “Source”© 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.