Documentation / @interstellar-tools/temporal / dateFromJulianDate
Function: dateFromJulianDate()
ts
function dateFromJulianDate(jd: number, scale?: TimeScaleType): Date;Defined in: time-scales.ts:243
The UTC Date of a Julian date in a time scale: the inverse of julianDate.
Notes
- The result is rounded to the millisecond, the precision of a
Date. - A TAI or TT Julian date that falls inside a leap second, 23:59:60 UTC, has no
Date: it becomes 00:00:00 of the next day.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
jd | number | undefined | The Julian date in days (finite). |
scale? | TimeScaleType | 'UTC' | The time scale the Julian date counts in. Defaults to UTC. |
Returns
The moment as a Date.
Throws
- If
jdis not a finite number. - If
scaleis not a TimeScaleType, the moment is before 1972-01-01 for TAI, TT, TDB and GPS, or it's outside the range of aDate.
Example
ts
dateFromJulianDate(2451545, 'TT').toISOString(); // '2000-01-01T11:58:55.816Z'