suntime
Version, currently 1.0.01 version
- 1.0.0latestMay 23, 2020
github.com/captn3m0/suntime
A crystal shard to calculate sunrise and sunset times across the world.
3 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
suntime:
github: captn3m0/suntime
version: ~> 1.0.0Then run:
shards installshard.yml
- Crystal
0.34.0- License
- MIT
- Author
- Nemo
Dependencies
This version declares no dependencies.
README
suntime
Crystal library for calculating sunrise and sunset times. Uses the algorithm from https://www.esrl.noaa.gov/gmd/grad/solcalc/solareqns.PDF
Installation
-
Add the dependency to your
shard.yml:dependencies: suntime: github: captn3m0/suntime -
Run
shards install
Usage
require "suntime"
# Time is optional, local time is used otherwise
# It returns sunrise/sunset for TODAY, so if you want the next sunset, check accordingly
s = Suntime::Suntime.new(lat,long, time)
# Bangalore
s = Suntime::Suntime.new(12.955800, 77.620979)
s.sunrise
# 2020-05-22 05:52:48.0 +05:30 Local
s.sunset
# 2020-05-22 18:39:43.0 +05:30 Local
You can pass in a different time. The date is used for calculating the sunrise/sunset, and the timezone is used for return formatting.
TODO
- [ ] Implement the Atmospheric Refraction Effect calculation
- [ ] Uncomment true_solar_time after converting it to proper time object
Contributing
- Fork it (https://github.com/captn3m0/suntime/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Nemo - creator and maintainer
License
Licensed under the MIT License. See LICENSE file for details.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.0.0- Tagged
- May 23, 2020
- Commit
3e9ddb89f2bf- Crystal
0.34.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/captn3m0/suntime
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 13, 2026
- Synced
- Aug 13, 2026
- Versions
- 1