No description
Find a file
2026-05-30 19:19:07 -04:00
.github chore: stage P1 audit changes (docs/wiki/ci) 2026-05-30 18:37:17 -04:00
src fix: satisfy strict null checks in spk/math/visibility 2026-05-30 18:50:48 -04:00
.editorconfig Initial release: moon-calc v1.0.0 2026-02-25 15:45:41 -05:00
.gitignore refactor: code quality improvements and fix arcvMinimum constant 2026-03-08 11:39:28 -04:00
.npmrc Initial release: moon-calc v1.0.0 2026-02-25 15:45:41 -05:00
.nvmrc Initial release: moon-calc v1.0.0 2026-02-25 15:45:41 -05:00
CHANGELOG.md chore: bump to v1.1.2 2026-05-30 19:19:07 -04:00
eslint.config.mjs chore: adopt shared config packages (tsconfig, eslint, prettier) 2026-05-30 15:12:49 -04:00
LICENSE Initial release: moon-calc v1.0.0 2026-02-25 15:45:41 -05:00
package.json chore: bump to v1.1.2 2026-05-30 19:19:07 -04:00
pnpm-lock.yaml docs: add TypeDoc API generation (typedoc@0.28.19 + typedoc-plugin-markdown@4.11.0) 2026-05-30 16:41:59 -04:00
pnpm-workspace.yaml Initial release: moon-calc v1.0.0 2026-02-25 15:45:41 -05:00
README.md chore: stage P1 audit changes (docs/wiki/ci) 2026-05-30 18:37:17 -04:00
test-cjs.cjs refactor: code quality improvements and fix arcvMinimum constant 2026-03-08 11:39:28 -04:00
test.mjs refactor: code quality improvements and fix arcvMinimum constant 2026-03-08 11:39:28 -04:00
tsconfig.json chore: adopt shared config packages (tsconfig, eslint, prettier) 2026-05-30 15:12:49 -04:00
tsup.config.ts Initial release: moon-calc v1.0.0 2026-02-25 15:45:41 -05:00
typedoc.json docs: add TypeDoc API generation (typedoc@0.28.19 + typedoc-plugin-markdown@4.11.0) 2026-05-30 16:41:59 -04:00

moon-sighting

npm version CI License: MIT

High-accuracy lunar crescent visibility and moon sighting calculations for Node.js and browsers. Uses the JPL DE442S ephemeris with full IERS Earth orientation for sub-arcsecond topocentric Moon and Sun positions. Implements the Yallop (NAO TN 69) and Odeh (Experimental Astronomy 2006) criteria.

Installation

npm install moon-sighting

Then download the JPL kernel (31 MB, one-time):

npx moon-sighting download-kernels

Quick Start

import { initKernels, getMoonSightingReport } from 'moon-sighting'

await initKernels()

const report = await getMoonSightingReport(new Date('2025-03-29'), {
  lat: 51.5074, lon: -0.1278, elevation: 10
})

console.log(report.yallop.category)   // 'A' — easily visible to the naked eye
console.log(report.odeh.zone)         // 'A' — visible with naked eye
console.log(report.guidance)

Five functions work without any kernel (Meeus approximation, ~0.3° accuracy):

import { getMoonPhase, getMoonPosition, getMoonIllumination,
         getMoonVisibilityEstimate, getMoon } from 'moon-sighting'

const phase = getMoonPhase()
console.log(phase.phaseName)      // 'Waxing Crescent'
console.log(phase.illumination)   // 14.3 (percent)

Documentation

Full documentation on the GitHub Wiki:

  • nrel-spa: Pure JS solar position algorithm
  • pray-calc: Islamic prayer times with dynamic angle algorithm

License

MIT. See LICENSE.