Open skipgraham opened 5 years ago
I think this is because of this part of code:
if date < Date() {
d = toDays(date: date)
} else {
d = toDays(date: Date())
}
So, if you want to get the moon illumination for tomorrow or later, you'll always get today's data.
Fix: just remove these lines from the getMoonIllumination function.
I've not quite figured this one out, but I have not dug into the algorithm. If I pass 15 consecutive dates into the moon illumination function, i would expect the return value for "phase" to progress through multiple phases. What I am getting is quite different.
What I am getting is something like this:
I found it odd that the first iteration produced a difference of ~.03 but the next series of iterations barely moved the needle. In theory, the moon phase should progress through a little over half a full cycle in 15 days. Any thoughts? It's certainly possible that I did not interpret the usage of the phase correctly - i.e. does it need to be used in combination with the angle to get the phase values 0.0 - 1.0