feat(routes-f): moon phase calculator#954
Open
dmystical-coder wants to merge 1 commit into
Open
Conversation
Add GET /api/routes-f/moon-phase?date=YYYY-MM-DD returning phase_name, illumination_percent, and age_days using a documented synodic-month approximation (reference new moon 2000-01-06 18:14 UTC, synodic month 29.53058867 days). Rejects impossible calendar dates via component round-trip. Tested against known new/full moon dates. Closes StreamFi-x#791
|
@dmystical-coder is attempting to deploy a commit to the david's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@dmystical-coder Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the moon phase calculator (#791).
GET /api/routes-f/moon-phase?date=YYYY-MM-DD→{ phase_name, illumination_percent, age_days }Approach
2000-01-06 18:14 UTCand mean synodic month29.53058867days (Meeus, Astronomical Algorithms). Lunar age is the elapsed time since the epoch reduced modulo the synodic month.(1 − cos(2π·age/synodic)) / 2.new,waxing crescent,first quarter,waxing gibbous,full,waning gibbous,last quarter,waning crescent) selected by nearest-eighth rounding so the principal phases sit on their exact ages.2024-02-30) via a component round-trip, sincenew Date(...)silently rolls overflow days into the next month.Tests
Validated against NASA new moons (2024-01-11, 2025-01-29) and full moons (2024-01-25, 2025-01-13), plus epoch, half-cycle, a full eight-phase walk, range invariants, and the route's 400 paths.
Scope
All files live under
app/api/routes-f/moon-phase/; the only import is the existing in-folder_lib/validatehelper, matching the mergedfiscal-quarter/deep-mergeroutes.Closes #791