@bridgerb/sol
v1.0.5
Published
Calculate solar time as a percentage of day or night
Readme
@bridgerb/sol
Calculate solar time as a percentage through the current day or night period.
Install
# npm
npm install @bridgerb/sol
# JSR (Deno, Node.js, Bun)
npx jsr add @bridgerb/sol
# Deno
deno add jsr:@bridgerb/solUsage
import { sol } from "@bridgerb/sol";
const { percentage, period } = sol({
date: new Date(),
latitude: 36.123589,
longitude: -121.638383,
});
console.log(`${percentage.toFixed(1)}% through the ${period}`);
// "45.2% through the day"API
sol(query: SolQuery): Sol
SolQuery
date: Date- The date/time to calculate forlatitude: number- Latitude in degreeslongitude: number- Longitude in degrees
Sol
percentage: number- 0-100, percentage through current periodperiod: "day" | "night"- Whether sun is above or below horizon
License
Unlicense - Public Domain
