Skip to content

Instantly share code, notes, and snippets.

View huseynzada's full-sized avatar
🏠
Working from home

huseynzade huseynzada

🏠
Working from home
View GitHub Profile
@Dither
Dither / moon_phase.js
Created September 17, 2016 10:07
JS function to calculate moon phase
function moon_phase(date) { // ported from http://www.voidware.com/moon_phase.htm
var year = date.getYear(),
month = date.getMonth(),
day = date.getDay();
if (month < 3) {
year--;
month += 12;
}