Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zman returned for next day #34

Open
mnemanov opened this issue Dec 28, 2021 · 1 comment
Open

Zman returned for next day #34

mnemanov opened this issue Dec 28, 2021 · 1 comment

Comments

@mnemanov
Copy link

mnemanov commented Dec 28, 2021

Hi

Getting Sunrise for Synday Australia for a given date.

The code returns sunrise on the following date.

(Local time is US Eastern time, and current time in Sydney is one day ahead - this might be affecting the calculation). Edit: After further checking, the local time is not relevant to the issue, see below.

@mnemanov
Copy link
Author

mnemanov commented Dec 29, 2021

I did a little further checking:

Testing for 12/29/2021, sunrise in Sydney Australia, (sunrise on 12/29 is 5:45:57 am local time). Sydney Australia is UTC +11

            ITimeZone timeZone = new OlsonTimeZone("Australia/Sydney");
            var location = new GeoLocation("Sydney Australia", -33.86, 151, 0, timeZone);
            var czc = new ComplexZmanimCalendar(DateTime.Parse("2021-12-29"), location);

GetTimeUtc returns 18.76... which is the UTC time of sunrise. (When it is sunrise in Sydney on 12/29 it is still 12/28 UTC)

GetDateFromTime converts 18.76 to 6:45pm on the selected date of 12/29, and then adjusts for local time by adding 11 hrs, so it returns 12/30/2021 5:45am. (it would seem that the time is correct for 12/29 not for 12/30).

This issue should not affect GetSunsetTime (since sunset in Syndey on 12/29 is also 12/29 UTC), but GetSunsetTime also calls GetSunriseTime and then calls GetAdjustedSunsetDate which adds a day to the sunset because it is now a day before the incorrectly adjusted sunrise.

Same issue affects Tzais, etc.

So I see the issue, not sure what is the best approach for fixing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant