zero-deps-prayer-times
Version:
A lightweight, embeddable Islamic prayer times calculator based on date and coordinates, with zero external dependencies.
17 lines (13 loc) • 452 B
text/typescript
import { round } from "../utils/formatting";
export function getDayLength(hourAngle: number, EoT: number) {
try {
const totalHourAngle = 2 * hourAngle;
const dayLengthInHours = totalHourAngle / 15;
let dayLengthInMinutes = dayLengthInHours * 60;
dayLengthInMinutes += EoT;
return Number(round(dayLengthInMinutes).toFixed(0));
} catch (error) {
console.error("Error calculating day length", error);
throw error;
}
}