Closed vincentneo closed 1 year ago
Thanks a lot for this work. I'll go through it asap!
After giving a small thought, I am wondering. I agree there is an ambiguity with the date part, but should this "fix" be implemented inside SwiftAA or the "client" code ? Because I could make myself a choice here, and say, the "rise" date is the reference. But other people may prefer something else.
I agree that when providing JulianDays it would make more sense but,...
the "client" code
I was doing that prior; offsetting the date from the returned JulianDay
, but it was quite error prone when I had to do it many times in many places all around the code.
Because I could make myself a choice here, and say, the "rise" date is the reference. But other people may prefer something else.
I chose transit for the comparison, because its always of the source date. I feel that it wouldn't make sense to pass in 10 Oct, and get computed results for 11 Oct's events.
Vincent, I realised I am using the old and deprecated RiseTransitSet
class since a long time. I will close the PR, and make a release with the new class.
Hi again,
I now believe that issue #97 is a real issue.
If we were to look at the same chunk of code again, this time with UTC time, it will make a lot more sense why it happens:
Let's take a look at the Singapore example. In UTC time, date is the same, but rise time is, according to UTC time, is later than set time. For Paris, it's fine, as the timezone offset is not that large to UTC time, and the time doesn't spill to the next/prev day.
The implementation of the
RiseTransitSet
, for rise, transit and set is as follows:This meant that year, month and day is always going to be a constant date, regardless if in some regions, where the rise/set overlaps to another day or not, according to UTC time, especially in places where its timezones are of larger offsets to UTC. This should be wrong, I believe.
Which is why I have opened this pull request with a small patch that checks if rise/set date is less/more than transit time. If it is, for rise, a day will be subtracted off, while for set, a day will be added in.