Simple library to calculate the current phase of the moon
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers




JSR Score
64%
Published
a year ago (1.0.1)
tinyLunarPhase
A very minimal Javascript library for working out the current lunar phase.
Examples
To get started, you can either directly import lunar.js to your HTML file or use a package manager like Deno or npm.
// Depends on what package manager you're using. This example is for regular js. const { getMoonPhase } = require('./lunar.js'); // Create a date object, or use Date() to represent the current time. const date = new Date('2024-02-28'); // Find the current moon phase const moonPhase = getMoonPhase(date); // You will recieve an object like this {text: 'Waning Gibbous', emoji: '🌖'}
You can find a better example in the examples folder
Contributions
I accept contributions. This project is quite minimal, and I would like to keep it that way for now, but bug-fixes, documentation and smaller new features are great.
License
BSD 3-Clause - Check LICENSE for more details.
Add Package
deno add jsr:@matthew/lunar
Import symbol
import * as lunar from "@matthew/lunar";
Import directly with a jsr specifier
import * as lunar from "jsr:@matthew/lunar";
Add Package
pnpm i jsr:@matthew/lunar
pnpm dlx jsr add @matthew/lunar
Import symbol
import * as lunar from "@matthew/lunar";
Add Package
yarn add jsr:@matthew/lunar
yarn dlx jsr add @matthew/lunar
Import symbol
import * as lunar from "@matthew/lunar";
Add Package
vlt install jsr:@matthew/lunar
Import symbol
import * as lunar from "@matthew/lunar";
Add Package
npx jsr add @matthew/lunar
Import symbol
import * as lunar from "@matthew/lunar";
Add Package
bunx jsr add @matthew/lunar
Import symbol
import * as lunar from "@matthew/lunar";