Calculate sun position, sunlight phases, moon position, and lunar phase for a given location and time with this lightweight, dependency-free JavaScript library
Suncalc is an open-source JavaScript library developed by Vladimir Agafonkin for calculating the position of the sun and moon as well as sunlight phases (sunrise, sunset, dusk, etc) based on date, time and geographic location. It is designed to be lightweight, fast and have no dependencies, making Suncalc easy to integrate into web applications.
Some key features of Suncalc include:
Suncalc provides an accurate solar position algorithm and has been tested against official data sources. It can account for atmospheric refraction during sunrise and sunset. The moon calculations are based on an accurate ephemeris model. There are no limitations or quotas.
Because of its lightweight footprint and ease of use, Suncalc is popular for integrating solar information into map tools, weather apps, calendars, automated home technology, solar energy projects and other web/mobile applications where sunrise, sunset or moon times are needed.
Here are some alternatives to Suncalc:
Suggest an alternative ❐