Skip to content

Instantly share code, notes, and snippets.

View Alkalurops's full-sized avatar
🦖
on the hunt for new adventures

Richard Alkalurops

🦖
on the hunt for new adventures
  • Echo Cluster Corporation, Inc.
  • Echo Cluster
View GitHub Profile
@datatypevoid
datatypevoid / getMoonPhase.ts
Last active September 11, 2022 15:42 — forked from endel/getMoonPhase.js
Get moon phase by Date, written in TypeScript. Accurate from year 1900 to 2199 inclusive.
export { EMoonPhase, EMoonPhaseName, MOON_PHASE_NAMES, moonPhase }
const { round, trunc: truncate } = Math
enum EMoonPhase {
New = 0,
WaxingCrescent,
@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;
}
@endel
endel / getMoonPhase.js
Created March 25, 2015 16:04
Get Moon Phase by Date, written in JavaScript
/*
* modified from http://www.voidware.com/moon_phase.htm
*/
function getMoonPhase(year, month, day)
{
var c = e = jd = b = 0;
if (month < 3) {
year--;