mirror of
https://github.com/acamarata/pray-calc.git
synced 2026-06-30 19:04:26 +00:00
17 lines
573 B
JavaScript
17 lines
573 B
JavaScript
function getQiyam(fajrTime, ishaTime) {
|
|
// Adjust Fajr time if it is earlier than Isha time
|
|
const adjustedFajrTime = fajrTime < ishaTime ? fajrTime + 24 : fajrTime;
|
|
|
|
// Calculate the length of the night
|
|
const nightLength = adjustedFajrTime - ishaTime;
|
|
|
|
// Calculate the start of the last third of the night
|
|
const lastThirdStart = ishaTime + (2 * nightLength / 3);
|
|
|
|
// If the result is greater than 24, adjust it to get the correct time
|
|
return lastThirdStart > 24 ? lastThirdStart - 24 : lastThirdStart;
|
|
}
|
|
|
|
module.exports = {
|
|
getQiyam
|
|
};
|