I’ve been using it for a couple of months and it’s as accurate as I can find.
© 2011-2015, Vladimir Agafonkin
// sun calculations are based on http://aa.quae.nl/en/reken/zonpositie.html formulas
// moon calculations, based on http://aa.quae.nl/en/reken/hemelpositie.html formulas
// calculations for moon rise/set times are based on http://www.stargazing.net/kepler/moonrise.html article
// calculations for illumination parameters of the moon,
// based on http://idlastro.gsfc.nasa.gov/ftp/pro/astro/mphase.pro formulas and
// Chapter 48 of “Astronomical Algorithms” 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.