SunCalc is a tiny dependency-free JavaScript library for calculating solar and lunar information for any location and time. It provides sun altitude and azimuth together with sunrise, sunset, twilight, and other sunlight phases. Moon calculations include position, rise and set times, distance, and illuminated phase. Version 2 rebuilt the astronomy around higher-order models from Jean Meeus and validates results against authoritative astronomical references. Typical rise and set errors are around 15 seconds, with substantially improved positional accuracy over the earlier release. It ships as a modern ES module while retaining bundled support for CommonJS and direct browser use.

Features

  • Sun position calculations
  • Sunrise, sunset, and twilight times
  • Moon position and distance
  • Moonrise, moonset, and lunar phase
  • High-precision astronomical models
  • ES module, CommonJS, and browser support

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

BSD License

Follow SunCalc

SunCalc Web Site

Other Useful Business Software
Build Agents and Models on One Platform Icon
Build Agents and Models on One Platform

Everything you need to build production-ready agents and models. Access 200+ Google and third-party AI models and tools.

Gemini Enterprise Agent Platform is Google Cloud's comprehensive platform for developers to build, scale, govern, and optimize agents and models. Choose from Google's most advanced models and third-party models like Anthropic's Claude Model Family.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of SunCalc!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Libraries

Registered

1 day ago