You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nemo bfe26c05d8
Create FUNDING.yml
10 months ago
.github Create FUNDING.yml 10 months ago
spec [tests] Minor test fixes 2 years ago
src Version Bump (1.0.0) 3 years ago
.editorconfig Initial commit 3 years ago
.gitignore Initial commit 3 years ago
.travis.yml [ci] Travis crystal fixes 2 years ago
LICENSE Bump to new crystal 2 years ago Version Bump (1.0.0) 3 years ago
shard.yml Bump to new crystal 2 years ago


Crystal library for calculating sunrise and sunset times. Uses the algorithm from


  1. Add the dependency to your shard.yml:

        github: captn3m0/suntime
  2. Run shards install


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 =,long, time)
# Bangalore
s =, 77.620979)
# 2020-05-22 05:52:48.0 +05:30 Local
# 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.


  • Implement the Atmospheric Refraction Effect calculation
  • Uncomment true_solar_time after converting it to proper time object


  1. Fork it (
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request


  • Nemo - creator and maintainer


Licensed under the MIT License. See LICENSE file for details.