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

Help understanding the timezone field of a LocationInfo, does it do anything when used in tandem with sun? #87

Open
HarrisonWilde opened this issue Jan 19, 2023 · 0 comments

Comments

@HarrisonWilde
Copy link

Hi, I have a use case where I know my longitude and latitude but not the timezone (using IP to get my current approx lat and long). I want to then use this package to calculate the sunrise and sunset times for my location. However, I am unsure what I should set the timezone to in the argument when instantiating LocationInfo. I can use the dateutil module to ensure when I instantiate sun on the LocationInfo I pass it tz.tzlocal() to its tzinfo argument, but I don't understand what the timezone set prior to this will do? E.g. say I instantiate a lat and long roughly on the west coast of the US:

city = LocationInfo(latitude = 34, longitude = -118)

The timezone will default to Europe/London. If I then do:

s = sun(city.observer, date=datetime.today(), tzinfo=tz.tzlocal())

Assuming I am actually at that lat/long, the times returned seem correct, even though the timezone on the city is incorrect? Hope my question makes sense.

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