astronomy-bundle-js icon indicating copy to clipboard operation
astronomy-bundle-js copied to clipboard

modify getTimeOfInterestOfUpcomingPhase in moonPhaseCalc.ts

Open hjy1210 opened this issue 3 years ago • 0 comments

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:

  1. Modify function getTimeOfInterestOfUpcomingPhase in moonPhaseCalc.ts to solve above problem.
  2. Modify test data in Moon.test.js
  3. Modify test data in moonPhaseCalc.test.js and add four new tests.

hjy1210 avatar Jan 18 '21 17:01 hjy1210