Documentation / @interstellar-tools/temporal / taiMinusUtc
Function: taiMinusUtc()
ts
function taiMinusUtc(date: Date): number;Defined in: time-scales.ts:123
TAI − UTC, in s, at a moment: the number of leap seconds so far, plus the 10 s UTC started with in 1972.
Where:
is TAI − UTC, from the leap second table LEAP_SECONDS(s)
Notes
- The table in
@interstellar-tools/constantsholds the leap seconds the IERS has announced. A moment after a leap second that isn't in it yet gets an offset 1 s short: keep the package up to date. - A JavaScript
Datecan't hold 23:59:60, the leap second itself: it goes from 23:59:59.999 to 00:00:00 of the next day, where the new offset starts.
Parameters
| Parameter | Type | Description |
|---|---|---|
date | Date | The moment, as a UTC Date (on or after 1972-01-01). |
Returns
number
TAI − UTC in s: a whole number, 37 since 2017.
Throws
- If
dateis not a validDate. - If
dateis before 1972-01-01.
Example
ts
taiMinusUtc(new Date('2016-12-31T23:59:59Z')); // 36
taiMinusUtc(new Date('2017-01-01T00:00:00Z')); // 37