From 621f769441a807bcbb0a2ed1049c6b7e612bd6cf Mon Sep 17 00:00:00 2001 From: Nemo Date: Fri, 22 May 2020 20:00:20 +0530 Subject: [PATCH] Update README --- README.md | 9 ++++++++- spec/suntime_spec.cr | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f9962e..161e2be 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,14 @@ Crystal library for calculating sunrise and sunset times. Uses the algorithm fro require "suntime" # Time is optional, local time is used otherwise -Suntime.new(lat,long, time) +# 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 ``` ## Development diff --git a/spec/suntime_spec.cr b/spec/suntime_spec.cr index a2d29ac..3fc455e 100644 --- a/spec/suntime_spec.cr +++ b/spec/suntime_spec.cr @@ -8,6 +8,7 @@ describe Suntime do l = Time::Location.load("America/New_York") t = Suntime::Suntime.new(lat, lng, Time.local(1990, 6, 25, 0, 0, 0, location: l)) + # TODO: These are stupid tests, figure out how to use epsilon for float tests in Crystal t.day_of_year.should eq(176) t.approx_time.should eq(176.45638888888888) t.approx_time(false).should eq(176.95638888888888)