MCPcopy
hub / github.com/mourner/suncalc / deltaT

Function deltaT

index.js:25–35  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

23// negligible for the Sun (<0.001°), real for the Moon. d only needs ~month accuracy here (ΔT
24// changes <1 s/yr), so the decimal year is derived arithmetically from d rather than from the Date.
25function deltaT(d) {
26 const y = 2000 + d / 365.2425;
27 let t;
28 if (y < 1920) { t = y - 1900; return -2.79 + t * (1.494119 + t * (-0.0598939 + t * (0.0061966 - t * 0.000197))); }
29 if (y < 1941) { t = y - 1920; return 21.20 + t * (0.84493 + t * (-0.076100 + t * 0.0020936)); }
30 if (y < 1961) { t = y - 1950; return 29.07 + t * (0.407 + t * (-1 / 233 + t / 2547)); }
31 if (y < 1986) { t = y - 1975; return 45.45 + t * (1.067 + t * (-1 / 260 - t / 718)); }
32 if (y < 2005) { t = y - 2000; return 63.86 + t * (0.3345 + t * (-0.060374 + t * (0.0017275 + t * (0.000651814 + t * 0.00002373599)))); }
33 if (y < 2050) { t = y - 2000; return 62.92 + t * (0.32217 + t * 0.005589); }
34 t = (y - 1820) / 100; return -20 + 32 * t * t - 0.5628 * (2150 - y);
35}
36function toDaysTT(d) {
37 return d + deltaT(d) / 86400;
38}

Callers 1

toDaysTTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…