UNPKG

@observerly/astrometry

Version:

observerly's lightweight, zero-dependency, type safe astrometry library written in Typescript for calculating the position of celestial objects in the sky.

24 lines (23 loc) 1.22 kB
import { J1970 as u } from "./constants.js"; import { g as f } from "./epoch-nmyjNjKp.js"; // @license Copyright © 2021-2023 observerly const J = (o) => new Date((o - u) * 864e5), U = (o, e) => { const { longitude: l } = e; let t = o - l / 15; return t < 0 && (t += 24), t > 24 && (t -= 24), t; }, v = (o, e) => { e = new Date(e.getTime() + e.getTimezoneOffset() * 6e4); const l = f(new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), 0, 0, 0, 0))), t = f(new Date(Date.UTC(e.getFullYear(), 1, 1, 0, 0, 0, 0))) - 1, g = l - t, a = (t - 2415020) / 36525, D = 24 - (6.6460656 + 2400.051262 * a + 2581e-8 * a ** 2) + 24 * (e.getFullYear() - 1900); let n = 0.0657098 * g - D; n < 0 && (n += 24), n > 24 && (n -= 24); let s = o - n; s < 0 && (s += 24); const r = 0.99727 * s, i = Math.floor(r), c = Math.floor((r - i) * 60), T = Math.floor(((r - i) * 60 - c) * 60), m = Math.floor((((r - i) * 60 - c) * 60 - T) * 1e3); return new Date(e.getFullYear(), e.getMonth(), e.getDate(), i, c, T, m); }; export { v as convertGreenwhichSiderealTimeToUniversalTime, J as convertJulianDateToUTC, U as convertLocalSiderealTimeToGreenwhichSiderealTime }; //# sourceMappingURL=temporal.js.map