All Projects → ypid → suncalc

ypid / suncalc

Licence: BSD-2-Clause license
A Haxe library for calculating sun/moon positions and phases. Targets a variety of programming languages/platforms.

Programming Languages

haxe
709 projects
Makefile
30231 projects
python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language
JSONiq
15 projects
shell
77523 projects
CSS
56736 projects

suncalc

Build Status BSD licensed haxelib version NPM version Packagist version

GitHub stars GitHub forks GitHub watchers GitHub open issues GitHub closed issues GitHub open pull requests GitHub closed pull requests

The SunCalc module allows to calculate sun position, sunlight phases (times for sunrise, sunset, dusk, etc.), moon position and lunar phase for the given location and time.

SunCalc was ported to Haxe by Robin ypid Schneider to allow using it in a planed rewrite of the opening hours library.

It is based on the JavaScript implementation created by Vladimir Agafonkin (@mourner) as a part of the SunCalc.net project.

Most calculations are based on the formulas given in the excellent Astronomy Answers articles about position of the sun and the planets. You can read about different twilight phases calculated by SunCalc in the Twilight article on Wikipedia.

Refer to the API documentation for details.

Install

Install the library for your favorite language by executing one of the following commands:

haxelib install suncalc         # Haxe
npm install suncalc             # JavaScript/Node.JS
composer require ypid/suncalc   # PHP

Supported languages/platforms

Supported languages/platforms not generated by Haxe

Limitations

The following limitations seems to be related which should mean that when they are fixed for one target, the tests for the other targets should also pass. If you need SunCalc.getMoonTimes for one of those targets, feel free to debug it further.

  • Python: SunCalc.getMoonTimes (rise date can not be calculated.).
  • C++: SunCalc.getMoonTimes (segmentation fault).
  • Java: SunCalc.getMoonTimes (java.lang.NullPointerException).
  • Neko: SunCalc.getMoonTimes

Unsure/untested

  • ActionScript 3: Does compile but I have no idea how to test it.
  • Flash: Does compile but I have no idea how to test it.

Unsupported

  • C#: Dependency datetime does not compile on target "datetime/3,0,2/src/datetime/DateTime.hx:146: characters 28-110 : haxe.Int64 should be Float"

    Priority low.

License

BSD-2-Clause

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].