astronomy-bundle-js
astronomy-bundle-js copied to clipboard
modify getTimeOfInterestOfUpcomingPhase in moonPhaseCalc.ts
Issue #21 opend by swgordon : getUpcomingLastQuarter skipping actual next date of last quarter moon phase
Problem: When I try to take above issue, I found below issue in Moon.test.js.
Given
const toi = createTimeOfInterest.fromTime(1992, 4, 12, 0, 0, 0);
const moon = createMoon(toi);
Want to test
- moon.getUpcomingNewMoon() with {year: 1992, month: 4, day: 3, hour: 5, min: 2, sec: 3}
- moon.getUpcomingFirstQuarter() with {year: 1992, month: 4, day: 10, hour: 10, min: 6, sec: 42}
Obvisously date 1992/4/13 and 1992/4/10 are before 1992/4/12, contradict to "upcoming".
I think it is a bug need to be fixed.
Solution:
- Modify function getTimeOfInterestOfUpcomingPhase in moonPhaseCalc.ts to solve above problem.
- Modify test data in Moon.test.js
- Modify test data in moonPhaseCalc.test.js and add four new tests.