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
Ship Agents Faster Icon
Ship Agents Faster

Transform your applications and workflows into powerful agentic systems at global scale.

Gemini Enterprise Agent Platform lets you rapidly build, scale, govern and optimize production-ready agents grounded in your organization's data. The platform enables developers to build custom or pre-built agents for virtually any use case. New customers get $300 in free credits.
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

21 hours ago