SunTimes

Build Status

This is a Fork of joeyates/ruby-sun-times and is avalible as sun-times gem so there is no explicit require necessary in rails projects.

Calculates sunrise and sunset times.

An implementation of the algorithm described at http://williams.best.vwh.net/sunrise_sunset_algorithm.htm

Installation

Add this line to your application's Gemfile:

gem 'sun-times'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sun-times

Usage

SunTimes.rise(Date.new(2010, 3, 8), 51.506318, 7.460659)             # => 2010-03-08 06:01:02 UTC
SunTimes.calculate(:set, Date.new(2010, 3, 8), 51.506318, 7.460659)  # => 2010-03-08 06:01:02 UTC
SunTimes.set(Date.new(2010, 3, 8), 51.506318, 7.460659)              # => 2010-03-08 17:22:07 UTC
SunTimes.calculate(:set, Date.new(2010, 3, 8), 51.506318, 7.460659)  # => 2010-03-08 17:22:07 UTC

Contributing

  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 new Pull Request

References