diff --git a/src/utils/geo.js b/src/utils/geo.js index 8ce24e8..6e11edd 100644 --- a/src/utils/geo.js +++ b/src/utils/geo.js @@ -130,9 +130,9 @@ export const getMoonPosition = (date) => { export const getMoonPhase = (date) => { const JD = date.getTime() / 86400000 + 2440587.5; const T = (JD - 2451545.0) / 36525; - const D = (297.850 + 445267.1115 * T) % 360; // Mean elongation - // Phase angle (simplified) - const phase = ((D + 180) % 360) / 360; + const D = (297.850 + 445267.1115 * T) % 360; // Mean elongation: 0=new, 180=full + // Normalize to 0-1 range (0=new, 0.5=full) + const phase = (((D % 360) + 360) % 360) / 360; return phase; };