Comments (3)
Is your local timezone set to UTC?
>>> import time
>>> time.tzname
('EET', 'EEST')
>>> from suntime import Sun
>>> sun = Sun(43, -88)
>>> sun.get_local_sunrise_time()
datetime.datetime(2024, 1, 3, 15, 24, tzinfo=tzlocal())
>>> sun.get_local_sunrise_time().tzname()
'EET'
>>> sun.get_sunrise_time()
datetime.datetime(2024, 1, 3, 13, 24, tzinfo=tzutc())
>>> sun.get_sunrise_time().tzname()
'UTC'
from suntime.
You can also just use time_zone=tz.gettz('US/Central')
when you call the functions to get the correct timezone.
from suntime.
My local timezone is set to ('GMT', 'BST')
but get_local_sunrise_time()
gives the time in UTC
(which is equal to GMT
but not BST
).
sun.get_local_sunrise_time().tzname
returns None
Ah, I see this function is being deprecated.
This seems to be a reliable drop-in for me
get_local_sunrise_time = lambda: sun.get_sunrise_time(
time_zone=datetime.datetime.now().astimezone().tzinfo)
from suntime.
Related Issues (20)
- Publish on PiPy HOT 1
- Another ValueError on corner case HOT 1
- Tests
- Local Sunset time wrong when UTC sunset is in following day HOT 8
- Sunrise after sunset for NZ coordinates HOT 5
- Did suntime change? HOT 2
- North and south latitude problems HOT 4
- Big issue of suntime HOT 3
- Inconsistent sunrise times between neighbouring zones HOT 5
- cannot import name 'Sun' from partially initialized module 'suntime' (most likely due to a circular import) HOT 6
- Sunrise local time is out by 1 hour a day before daylight savings starts. Sunset is correct.
- Bug in day wrap for sunset times HOT 2
- No seconds calculations? HOT 1
- suppress print() HOT 1
- get_local_sunrise_time changed incompatibly HOT 1
- Commit e9b1fa4 has breaking change HOT 1
- default argument values are cached
- Sunset returned as yesterday HOT 7
- Feature request: report whether we have midnight sun or polar night
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from suntime.