# toJulianDateParts

Industry: Core

:::caution[Unreleased]
Not in `@northguild/gmt` 1.21.0 on npm yet. It is on `main` and ships in the next release.
:::

## Signature

```ts
toJulianDateParts(isoString: string, scale?: TimeScale): JulianDateParts | null
```

Convert a UTC instant to a two-part Julian Date `{ jd1, jd2 }` on a time scale, exact to the nanosecond. The scale defaults to `"UTC"`.

- Two parts exist because one double near JD 2 460 000 resolves only to about 40 µs. For a single number use `toJulianDate`.
- JD days begin at noon (IAU 1997 B1 App. 2): midnight UTC has `jd2 = 0.5`.
- `jd1` is a whole number and `jd2` lies in [0, 1). `fromJulianDateParts` accepts any split.
- `jd2` is one correctly rounded division (IEEE 754-2019 §4.3), within 2⁻⁵⁴ day (0.0048 ns) of the exact value; times at most 86 401 s that stays under 0.01 ns, so rounding to the nearest nanosecond recovers the input: `fromJulianDateParts(toJulianDateParts(x, s), s)` is `x` in `Z` form with Temporal's shortest fraction, on every instant in the domain and every scale.
- On `"UTC"` the count is ERFA's quasi-JD: a leap-second day counts as one day, so noon on that day is not `.0`, and the difference between two UTC JDs is not an exact interval (ERFA `dtf2d.c` Notes 4 and 7). On `"TAI"`, `"TT"` and `"TCG"` it is a true JD, read from the label `toTAI` / `toTT` / `toTCG` writes. 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.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `isoString` | `string` | ISO 8601 instant string |
| `scale` | `TimeScale` | the time scale to count on, default `"UTC"` |

## Returns

the two parts, or null on invalid input, an unknown scale or an instant outside the domain

## Related types

- [`TimeScale`](/gmt/reference/types/TimeScale/)
- [`JulianDateParts`](/gmt/reference/types/JulianDateParts/)

## Examples

```ts
import { toJulianDateParts } from "@northguild/gmt/timescale/convert";

toJulianDateParts("2000-01-01T12:00:00Z") // { jd1: 2451545, jd2: 0 }
```

## Source

[timescale/convert/toJulianDateParts.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/timescale/convert/toJulianDateParts.ts)
