prayertiming
Version:
A small library to calculate muslim prayer times based on coordinates and timezone
54 lines (51 loc) • 1.18 kB
JavaScript
;
function degreeToRadian(degree) {
return (degree * Math.PI) / 180.0;
}
function radianToDegree(radian) {
return (radian * 180.0) / Math.PI;
}
function sin(degree) {
return Math.sin(degreeToRadian(degree));
}
function cos(degree) {
return Math.cos(degreeToRadian(degree));
}
function tan(degree) {
return Math.tan(degreeToRadian(degree));
}
function arcsin(degree) {
return radianToDegree(Math.asin(degree));
}
function arccos(degree) {
return radianToDegree(Math.acos(degree));
}
function arccot(x) {
return radianToDegree(Math.atan(1 / x));
}
function arctan2(y, x) {
return radianToDegree(Math.atan2(y, x));
}
function fix(a, b) {
let x = a;
x -= b * Math.floor(a / b);
return x < 0 ? x + b : x;
}
function fixAngle(a) {
return fix(a, 360);
}
function fixHour(a) {
return fix(a, 24);
}
exports.arccos = arccos;
exports.arccot = arccot;
exports.arcsin = arcsin;
exports.arctan2 = arctan2;
exports.cos = cos;
exports.degreeToRadian = degreeToRadian;
exports.fix = fix;
exports.fixAngle = fixAngle;
exports.fixHour = fixHour;
exports.radianToDegree = radianToDegree;
exports.sin = sin;
exports.tan = tan;