Skip to content

A simple frontend for api.sunrise-sunset.org, to get various sun related event timings for the given date.

Notifications You must be signed in to change notification settings

m33mt33n/suntimes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Suntimes

A simple frontend for api.sunrise-sunset.org, which displays information about various sun related events for given date.

Features

  • Pretty prints times for below events:
    • Sunrise
    • Sunset
    • Solar noon
    • Day length
    • Civil twilight
    • Nautical twilight
    • Astronomical twilight
  • Supports auto-detection of user's location using ip-api.com

Installation

# Using go command
CGO_ENABLED=0 go install -ldflags="-s -w" -v github.com/m33mt33n/suntimes@latest

# Using git
git clone "https://github.com/m33mt33n/suntimes.git"
cd suntimes
CGO_ENABLED=0 go build -ldflags="-s -w" -v .

Usage

Usage of suntimes:
  -city string
      city name to be used (default "Unknown")
  -coordinates string
      coordinates in lat,lon format (default "24.85468,67.02071")
  -date %Y-%m-%d
      date to get times for in %Y-%m-%d format (default "<today's date>")
  -detect-location
      detect location by using ip address
  -timezone string
      timezone to be used by default it will use $TZ environment variable. (default "<system's $TZ>")

Examples

# Use auto-detection feature
suntimes -detect-location=true

# Or specify locatiom explicitly if auto-detection not worked for your location
suntimes -city=Lahore -coordinates='31.566,74.314' -timezone='Asia/Karachi'

About

A simple frontend for api.sunrise-sunset.org, to get various sun related event timings for the given date.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages