API Reference / lunarPhases · function

Function: lunarPhases()

function lunarPhases(
   engine, 
   jdStart, 
   jdEnd, 
   maxHits?): [number, PhaseName][];

Every principal lunar phase (new, first quarter, full, last quarter) within [jdStart, jdEnd], sorted by time. Found from the Sun–Moon elongation crossing 0°/90°/180°/270°.

Parameters

ParameterTypeDefault valueDescription
engineEngineundefinedThe engine used to evaluate positions.
jdStartnumberundefinedStart of the window, Julian Day (UT).
jdEndnumberundefinedEnd of the window, Julian Day (UT).
maxHitsnumber60Cap on the number of phases returned. Defaults to 60.

Returns

[number, PhaseName][]

Sorted [jdUt, phase] pairs, where phase is one of PhaseName.

Example

const phases = lunarPhases(engine, julianDay(2025, 1, 1), julianDay(2025, 2, 1));
// [[jd, "new"], [jd, "first_quarter"], ...]

Start building

Quickstart →