From 248b75d58f4adfd16cce4010ff93fcc8531ecfd0 Mon Sep 17 00:00:00 2001 From: Ameir Al-Zoubi Date: Mon, 27 Apr 2020 22:51:05 -0400 Subject: [PATCH] added Turkey and Tehran calculation methods --- Adhan.js | 63 ++++++++++++++++++-------- Adhan.js.map | 2 +- README.md | 29 ++++++------ package.json | 2 +- src/CalculationMethod.js | 35 ++++++++++----- src/CalculationParameters.js | 3 +- src/PrayerTimes.js | 20 ++++++--- test/adhan.test.js | 86 +++++++++++++++++++++++++++++++++--- test/times.test.js | 4 ++ 9 files changed, 188 insertions(+), 56 deletions(-) diff --git a/Adhan.js b/Adhan.js index 3f19d65..0d077b3 100644 --- a/Adhan.js +++ b/Adhan.js @@ -634,12 +634,12 @@ class PrayerTimes_PrayerTimes { var nightFraction; dhuhrTime = new TimeComponents(solarTime.transit).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); sunriseTime = new TimeComponents(solarTime.sunrise).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); - maghribTime = new TimeComponents(solarTime.sunset).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); + var sunsetTime = new TimeComponents(solarTime.sunset).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); asrTime = new TimeComponents(solarTime.afternoon(Madhab_shadowLength(calculationParameters.madhab))).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); var tomorrow = dateByAddingDays(date, 1); var tomorrowSolarTime = new SolarTime_SolarTime(tomorrow, coordinates); var tomorrowSunrise = new TimeComponents(tomorrowSolarTime.sunrise).utcDate(tomorrow.getFullYear(), tomorrow.getMonth(), tomorrow.getDate()); - var night = (tomorrowSunrise - maghribTime) / 1000; + var night = (tomorrowSunrise - sunsetTime) / 1000; fajrTime = new TimeComponents(solarTime.hourAngle(-1 * calculationParameters.fajrAngle, false)).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); // special case for moonsighting committee above latitude 55 if (calculationParameters.method == "MoonsightingCommittee" && coordinates.latitude >= 55) { @@ -662,22 +662,22 @@ class PrayerTimes_PrayerTimes { } if (calculationParameters.ishaInterval > 0) { - ishaTime = dateByAddingMinutes(maghribTime, calculationParameters.ishaInterval); + ishaTime = dateByAddingMinutes(sunsetTime, calculationParameters.ishaInterval); } else { ishaTime = new TimeComponents(solarTime.hourAngle(-1 * calculationParameters.ishaAngle, true)).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); // special case for moonsighting committee above latitude 55 if (calculationParameters.method == "MoonsightingCommittee" && coordinates.latitude >= 55) { nightFraction = night / 7; - ishaTime = dateByAddingSeconds(maghribTime, nightFraction); + ishaTime = dateByAddingSeconds(sunsetTime, nightFraction); } var safeIsha = function () { if (calculationParameters.method == "MoonsightingCommittee") { - return src_Astronomical.seasonAdjustedEveningTwilight(coordinates.latitude, DateUtils_dayOfYear(date), date.getFullYear(), maghribTime); + return src_Astronomical.seasonAdjustedEveningTwilight(coordinates.latitude, DateUtils_dayOfYear(date), date.getFullYear(), sunsetTime); } else { var portion = calculationParameters.nightPortions().isha; nightFraction = portion * night; - return dateByAddingSeconds(maghribTime, nightFraction); + return dateByAddingSeconds(sunsetTime, nightFraction); } }(); @@ -686,6 +686,16 @@ class PrayerTimes_PrayerTimes { } } + maghribTime = sunsetTime; + + if (calculationParameters.maghribAngle) { + let angleBasedMaghrib = new TimeComponents(solarTime.hourAngle(-1 * calculationParameters.maghribAngle, true)).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); + + if (sunsetTime < angleBasedMaghrib && ishaTime > angleBasedMaghrib) { + maghribTime = angleBasedMaghrib; + } + } + var fajrAdjustment = (calculationParameters.adjustments.fajr || 0) + (calculationParameters.methodAdjustments.fajr || 0); var sunriseAdjustment = (calculationParameters.adjustments.sunrise || 0) + (calculationParameters.methodAdjustments.sunrise || 0); var dhuhrAdjustment = (calculationParameters.adjustments.dhuhr || 0) + (calculationParameters.methodAdjustments.dhuhr || 0); @@ -774,11 +784,12 @@ const HighLatitudeRule = { class CalculationParameters_CalculationParameters { - constructor(fajrAngle, ishaAngle, ishaInterval, methodName) { + constructor(methodName, fajrAngle, ishaAngle, ishaInterval, maghribAngle) { this.method = methodName || "Other"; this.fajrAngle = fajrAngle || 0; this.ishaAngle = ishaAngle || 0; this.ishaInterval = ishaInterval || 0; + this.maghribAngle = maghribAngle; this.madhab = Madhab.Shafi; this.highLatitudeRule = src_HighLatitudeRule.MiddleOfTheNight; this.adjustments = { @@ -830,7 +841,7 @@ class CalculationParameters_CalculationParameters { const CalculationMethod = { // Muslim World League MuslimWorldLeague: function () { - let params = new CalculationParameters_CalculationParameters(18, 17, 0, "MuslimWorldLeague"); + let params = new CalculationParameters_CalculationParameters("MuslimWorldLeague", 18, 17); params.methodAdjustments = { dhuhr: 1 }; @@ -838,7 +849,7 @@ const CalculationMethod = { }, // Egyptian General Authority of Survey Egyptian: function () { - let params = new CalculationParameters_CalculationParameters(19.5, 17.5, 0, "Egyptian"); + let params = new CalculationParameters_CalculationParameters("Egyptian", 19.5, 17.5); params.methodAdjustments = { dhuhr: 1 }; @@ -846,7 +857,7 @@ const CalculationMethod = { }, // University of Islamic Sciences, Karachi Karachi: function () { - let params = new CalculationParameters_CalculationParameters(18, 18, 0, "Karachi"); + let params = new CalculationParameters_CalculationParameters("Karachi", 18, 18); params.methodAdjustments = { dhuhr: 1 }; @@ -854,11 +865,11 @@ const CalculationMethod = { }, // Umm al-Qura University, Makkah UmmAlQura: function () { - return new CalculationParameters_CalculationParameters(18.5, 0, 90, "UmmAlQura"); + return new CalculationParameters_CalculationParameters("UmmAlQura", 18.5, 0, 90); }, // Dubai Dubai: function () { - let params = new CalculationParameters_CalculationParameters(18.2, 18.2, 0, "Dubai"); + let params = new CalculationParameters_CalculationParameters("Dubai", 18.2, 18.2); params.methodAdjustments = { sunrise: -3, dhuhr: 3, @@ -869,7 +880,7 @@ const CalculationMethod = { }, // Moonsighting Committee MoonsightingCommittee: function () { - let params = new CalculationParameters_CalculationParameters(18, 18, 0, "MoonsightingCommittee"); + let params = new CalculationParameters_CalculationParameters("MoonsightingCommittee", 18, 18); params.methodAdjustments = { dhuhr: 5, maghrib: 3 @@ -878,7 +889,7 @@ const CalculationMethod = { }, // ISNA NorthAmerica: function () { - let params = new CalculationParameters_CalculationParameters(15, 15, 0, "NorthAmerica"); + let params = new CalculationParameters_CalculationParameters("NorthAmerica", 15, 15); params.methodAdjustments = { dhuhr: 1 }; @@ -886,23 +897,39 @@ const CalculationMethod = { }, // Kuwait Kuwait: function () { - return new CalculationParameters_CalculationParameters(18, 17.5, 0, "Kuwait"); + return new CalculationParameters_CalculationParameters("Kuwait", 18, 17.5); }, // Qatar Qatar: function () { - return new CalculationParameters_CalculationParameters(18, 0, 90, "Qatar"); + return new CalculationParameters_CalculationParameters("Qatar", 18, 0, 90); }, // Singapore Singapore: function () { - let params = new CalculationParameters_CalculationParameters(20, 18, 0, "Singapore"); + let params = new CalculationParameters_CalculationParameters("Singapore", 20, 18); params.methodAdjustments = { dhuhr: 1 }; return params; }, + // Institute of Geophysics, University of Tehran + Tehran: function () { + let params = new CalculationParameters_CalculationParameters("Tehran", 17.7, 14, 0, 4.5); + return params; + }, + // Dianet + Turkey: function () { + let params = new CalculationParameters_CalculationParameters("Turkey", 18, 17); + params.methodAdjustments = { + sunrise: -7, + dhuhr: 5, + asr: 4, + maghrib: 7 + }; + return params; + }, // Other Other: function () { - return new CalculationParameters_CalculationParameters(0, 0, 0, "Other"); + return new CalculationParameters_CalculationParameters("Other", 0, 0); } }; /* harmony default export */ var src_CalculationMethod = (CalculationMethod); diff --git a/Adhan.js.map b/Adhan.js.map index 50420f6..8fb1e00 100644 --- a/Adhan.js.map +++ b/Adhan.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://adhan/webpack/universalModuleDefinition","webpack://adhan/webpack/bootstrap","webpack://adhan/./src/Coordinates.js","webpack://adhan/./src/MathUtils.js","webpack://adhan/./src/DateUtils.js","webpack://adhan/./src/Astronomical.js","webpack://adhan/./src/SolarCoordinates.js","webpack://adhan/./src/SolarTime.js","webpack://adhan/./src/TimeComponents.js","webpack://adhan/./src/Prayer.js","webpack://adhan/./src/Madhab.js","webpack://adhan/./src/PrayerTimes.js","webpack://adhan/./src/HighLatitudeRule.js","webpack://adhan/./src/CalculationParameters.js","webpack://adhan/./src/CalculationMethod.js","webpack://adhan/./src/Qibla.js","webpack://adhan/./src/SunnahTimes.js","webpack://adhan/./src/Adhan.js"],"names":["Coordinates","constructor","latitude","longitude","degreesToRadians","degrees","Math","PI","radiansToDegrees","radians","normalizeToScale","number","max","floor","unwindAngle","angle","quadrantShiftAngle","round","dateByAddingDays","date","days","year","getFullYear","month","getMonth","day","getDate","hours","getHours","minutes","getMinutes","seconds","getSeconds","Date","dateByAddingMinutes","dateByAddingSeconds","getTime","roundedMinute","getUTCSeconds","offset","dayOfYear","returnedDayOfYear","feb","Astronomical","isLeapYear","months","i","meanSolarLongitude","julianCentury","T","term1","term2","term3","pow","L0","meanLunarLongitude","Lp","ascendingLunarNodeLongitude","term4","Omega","meanSolarAnomaly","M","solarEquationOfTheCenter","meanAnomaly","Mrad","sin","apparentSolarLongitude","meanLongitude","Lambda","meanObliquityOfTheEcliptic","apparentObliquityOfTheEcliptic","Epsilon0","O","cos","meanSiderealTime","JD","Theta","nutationInLongitude","solarLongitude","lunarLongitude","ascendingNode","nutationInObliquity","altitudeOfCelestialBody","observerLatitude","declination","localHourAngle","Phi","delta","H","asin","approximateTransit","siderealTime","rightAscension","L","Theta0","a2","Lw","correctedTransit","previousRightAscension","nextRightAscension","m0","a1","a3","a","interpolateAngles","dm","correctedHourAngle","coordinates","afterTransit","previousDeclination","nextDeclination","h0","d2","d1","d3","H0","acos","m","interpolate","h","y2","y1","y3","n","b","c","julianDay","trunc","x","ceil","Y","D","A","B","i0","i1","seasonAdjustedMorningTwilight","sunrise","abs","d","adjustment","dyy","daysSinceSolstice","seasonAdjustedEveningTwilight","sunset","northernOffset","southernOffset","daysInYear","SolarCoordinates","dPsi","dEpsilon","EpsilonApparent","atan2","apparentSiderealTime","SolarTime","observer","solar","prevSolar","nextSolar","solarAltitude","approxTransit","transit","hourAngle","afternoon","shadowLength","tangent","inverse","tan","atan","TimeComponents","utcDate","UTC","Prayer","Fajr","Sunrise","Dhuhr","Asr","Maghrib","Isha","None","Madhab","Shafi","Hanafi","madhab","PrayerTimes","calculationParameters","solarTime","fajrTime","sunriseTime","dhuhrTime","asrTime","maghribTime","ishaTime","nightFraction","tomorrow","tomorrowSolarTime","tomorrowSunrise","night","fajrAngle","method","safeFajr","portion","nightPortions","fajr","isNaN","ishaInterval","ishaAngle","safeIsha","isha","fajrAdjustment","adjustments","methodAdjustments","sunriseAdjustment","dhuhrAdjustment","dhuhr","asrAdjustment","asr","maghribAdjustment","maghrib","ishaAdjustment","timeForPrayer","prayer","currentPrayer","nextPrayer","HighLatitudeRule","MiddleOfTheNight","SeventhOfTheNight","TwilightAngle","CalculationParameters","methodName","highLatitudeRule","CalculationMethod","MuslimWorldLeague","params","Egyptian","Karachi","UmmAlQura","Dubai","MoonsightingCommittee","NorthAmerica","Kuwait","Qatar","Singapore","Other","qibla","makkah","SunnahTimes","prayerTimes","nextDay","nextDayPrayerTimes","nightDuration","middleOfTheNight","lastThirdOfTheNight","adhan","Qibla"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B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BAAN,CAAkB;AAC7BrP,aAAW,CAACsP,WAAD,EAAc;AACrB,UAAMpO,IAAI,GAAGoO,WAAW,CAACpO,IAAzB;AACA,UAAMqO,OAAO,GAAGtO,gBAAgB,CAACC,IAAD,EAAO,CAAP,CAAhC;AACA,UAAMsO,kBAAkB,GAAG,IAAIjE,uBAAJ,CAAgB+D,WAAW,CAAC5I,WAA5B,EAAyC6I,OAAzC,EAAkDD,WAAW,CAAC9D,qBAA9D,CAA3B;AAEA,UAAMiE,aAAa,GAAG,CAACD,kBAAkB,CAAC9C,IAAnB,CAAwBvK,OAAxB,KAAoCmN,WAAW,CAAC7B,OAAZ,CAAoBtL,OAApB,EAArC,IAAsE,MAA5F;AAEA,SAAKuN,gBAAL,GAAwBtN,aAAa,CAACF,mBAAmB,CAACoN,WAAW,CAAC7B,OAAb,EAAsBgC,aAAa,GAAG,CAAtC,CAApB,CAArC;AACA,SAAKE,mBAAL,GAA2BvN,aAAa,CAACF,mBAAmB,CAACoN,WAAW,CAAC7B,OAAb,EAAsBgC,aAAa,IAAI,IAAI,CAAR,CAAnC,CAApB,CAAxC;AACH;;AAV4B,C;;ACHjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMG,KAAK,GAAG;AACVjF,QAAM,EAAEA,UADE;AAEVQ,QAAM,EAAEA,MAFE;AAGV4C,kBAAgB,EAAEA,oBAHR;AAIVhO,aAAW,EAAEA,WAJH;AAKVoO,uBAAqB,EAAEA,2CALb;AAMVG,mBAAiB,EAAEA,qBANT;AAOV/C,aAAW,EAAEA,uBAPH;AAQV8D,aAAW,EAAEA,uBARH;AASVQ,OAAK,EAAEV,KAAKA;AATF,CAAd;AAYeS,gFAAf,E","file":"Adhan.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"adhan\"] = factory();\n\telse\n\t\troot[\"adhan\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","export default class Coordinates {\n constructor(latitude, longitude) {\n this.latitude = latitude;\n this.longitude = longitude;\n }\n}\n","export function degreesToRadians(degrees) {\n return (degrees * Math.PI) / 180.0;\n}\n\nexport function radiansToDegrees(radians) {\n return (radians * 180.0) / Math.PI;\n}\n\nexport function normalizeToScale(number, max) {\n return number - (max * (Math.floor(number / max)))\n}\n\nexport function unwindAngle(angle) {\n return normalizeToScale(angle, 360.0);\n}\n\nexport function quadrantShiftAngle(angle) {\n if (angle >= -180 && angle <= 180) {\n return angle;\n }\n\n return angle - (360 * Math.round(angle/360));\n}\n","import Astronomical from './Astronomical';\n\nexport function dateByAddingDays(date, days) {\n const year = date.getFullYear();\n const month = date.getMonth();\n const day = date.getDate() + days;\n const hours = date.getHours();\n const minutes = date.getMinutes();\n const seconds = date.getSeconds();\n return new Date(year, month, day, hours, minutes, seconds);\n}\n\nexport function dateByAddingMinutes(date, minutes) {\n return dateByAddingSeconds(date, minutes * 60);\n}\n\nexport function dateByAddingSeconds(date, seconds) {\n return new Date(date.getTime() + (seconds * 1000));\n}\n\nexport function roundedMinute(date) {\n const seconds = date.getUTCSeconds();\n const offset = seconds >= 30 ? 60 - seconds : -1 * seconds;\n return dateByAddingSeconds(date, offset);\n}\n\nexport function dayOfYear(date) {\n let returnedDayOfYear = 0;\n const feb = Astronomical.isLeapYear(date.getFullYear()) ? 29 : 28;\n const months = [31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n for (let i = 0; i < date.getMonth(); i++) {\n returnedDayOfYear += months[i];\n }\n\n returnedDayOfYear += date.getDate();\n\n return returnedDayOfYear;\n}\n","import { degreesToRadians, radiansToDegrees, unwindAngle, normalizeToScale, quadrantShiftAngle } from './MathUtils';\nimport { dateByAddingSeconds } from './DateUtils';\n\nconst Astronomical = {\n\n /* The geometric mean longitude of the sun in degrees. */\n meanSolarLongitude: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 163 */\n const term1 = 280.4664567;\n const term2 = 36000.76983 * T;\n const term3 = 0.0003032 * Math.pow(T, 2);\n const L0 = term1 + term2 + term3;\n return unwindAngle(L0);\n },\n\n /* The geometric mean longitude of the moon in degrees. */\n meanLunarLongitude: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 144 */\n const term1 = 218.3165;\n const term2 = 481267.8813 * T;\n const Lp = term1 + term2;\n return unwindAngle(Lp);\n },\n\n ascendingLunarNodeLongitude: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 144 */\n const term1 = 125.04452;\n const term2 = 1934.136261 * T;\n const term3 = 0.0020708 * Math.pow(T, 2);\n const term4 = Math.pow(T, 3) / 450000;\n const Omega = term1 - term2 + term3 + term4;\n return unwindAngle(Omega);\n },\n\n /* The mean anomaly of the sun. */\n meanSolarAnomaly: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 163 */\n const term1 = 357.52911;\n const term2 = 35999.05029 * T;\n const term3 = 0.0001537 * Math.pow(T, 2);\n const M = term1 + term2 - term3;\n return unwindAngle(M);\n },\n\n /* The Sun's equation of the center in degrees. */\n solarEquationOfTheCenter: function(julianCentury, meanAnomaly) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 164 */\n const Mrad = degreesToRadians(meanAnomaly);\n const term1 = (1.914602 - (0.004817 * T) - (0.000014 * Math.pow(T, 2))) * Math.sin(Mrad);\n const term2 = (0.019993 - (0.000101 * T)) * Math.sin(2 * Mrad);\n const term3 = 0.000289 * Math.sin(3 * Mrad);\n return term1 + term2 + term3;\n },\n\n /* The apparent longitude of the Sun, referred to the\n true equinox of the date. */\n apparentSolarLongitude: function(julianCentury, meanLongitude) {\n const T = julianCentury;\n const L0 = meanLongitude;\n /* Equation from Astronomical Algorithms page 164 */\n const longitude = L0 + Astronomical.solarEquationOfTheCenter(T, Astronomical.meanSolarAnomaly(T));\n const Omega = 125.04 - (1934.136 * T);\n const Lambda = longitude - 0.00569 - (0.00478 * Math.sin(degreesToRadians(Omega)));\n return unwindAngle(Lambda);\n },\n\n /* The mean obliquity of the ecliptic, formula\n adopted by the International Astronomical Union.\n Represented in degrees. */\n meanObliquityOfTheEcliptic: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 147 */\n const term1 = 23.439291;\n const term2 = 0.013004167 * T;\n const term3 = 0.0000001639 * Math.pow(T, 2);\n const term4 = 0.0000005036 * Math.pow(T, 3);\n return term1 - term2 - term3 + term4;\n },\n\n /* The mean obliquity of the ecliptic, corrected for\n calculating the apparent position of the sun, in degrees. */\n apparentObliquityOfTheEcliptic: function(julianCentury, meanObliquityOfTheEcliptic) {\n const T = julianCentury;\n const Epsilon0 = meanObliquityOfTheEcliptic;\n /* Equation from Astronomical Algorithms page 165 */\n const O = 125.04 - (1934.136 * T);\n return Epsilon0 + (0.00256 * Math.cos(degreesToRadians(O)));\n },\n\n /* Mean sidereal time, the hour angle of the vernal equinox, in degrees. */\n meanSiderealTime: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 165 */\n const JD = (T * 36525) + 2451545.0;\n const term1 = 280.46061837;\n const term2 = 360.98564736629 * (JD - 2451545);\n const term3 = 0.000387933 * Math.pow(T, 2);\n const term4 = Math.pow(T, 3) / 38710000;\n const Theta = term1 + term2 + term3 - term4;\n return unwindAngle(Theta)\n },\n\n nutationInLongitude: function(julianCentury, solarLongitude, lunarLongitude, ascendingNode) {\n const L0 = solarLongitude;\n const Lp = lunarLongitude;\n const Omega = ascendingNode;\n /* Equation from Astronomical Algorithms page 144 */\n const term1 = (-17.2/3600) * Math.sin(degreesToRadians(Omega));\n const term2 = (1.32/3600) * Math.sin(2 * degreesToRadians(L0));\n const term3 = (0.23/3600) * Math.sin(2 * degreesToRadians(Lp));\n const term4 = (0.21/3600) * Math.sin(2 * degreesToRadians(Omega));\n return term1 - term2 - term3 + term4;\n },\n\n nutationInObliquity: function(julianCentury, solarLongitude, lunarLongitude, ascendingNode) {\n const L0 = solarLongitude;\n const Lp = lunarLongitude;\n const Omega = ascendingNode;\n /* Equation from Astronomical Algorithms page 144 */\n const term1 = (9.2/3600) * Math.cos(degreesToRadians(Omega));\n const term2 = (0.57/3600) * Math.cos(2 * degreesToRadians(L0));\n const term3 = (0.10/3600) * Math.cos(2 * degreesToRadians(Lp));\n const term4 = (0.09/3600) * Math.cos(2 * degreesToRadians(Omega));\n return term1 + term2 + term3 - term4;\n },\n\n altitudeOfCelestialBody: function(observerLatitude, declination, localHourAngle) {\n const Phi = observerLatitude;\n const delta = declination;\n const H = localHourAngle;\n /* Equation from Astronomical Algorithms page 93 */\n const term1 = Math.sin(degreesToRadians(Phi)) * Math.sin(degreesToRadians(delta));\n const term2 = Math.cos(degreesToRadians(Phi)) * Math.cos(degreesToRadians(delta)) * Math.cos(degreesToRadians(H));\n return radiansToDegrees(Math.asin(term1 + term2));\n },\n\n approximateTransit: function(longitude, siderealTime, rightAscension) {\n const L = longitude;\n const Theta0 = siderealTime;\n const a2 = rightAscension;\n /* Equation from page Astronomical Algorithms 102 */\n const Lw = L * -1;\n return normalizeToScale((a2 + Lw - Theta0) / 360, 1);\n },\n\n /* The time at which the sun is at its highest point in the sky (in universal time) */\n correctedTransit: function(approximateTransit, longitude, siderealTime, rightAscension, previousRightAscension, nextRightAscension) {\n const m0 = approximateTransit;\n const L = longitude;\n const Theta0 = siderealTime;\n const a2 = rightAscension;\n const a1 = previousRightAscension;\n const a3 = nextRightAscension;\n /* Equation from page Astronomical Algorithms 102 */\n const Lw = L * -1;\n const Theta = unwindAngle((Theta0 + (360.985647 * m0)));\n const a = unwindAngle(Astronomical.interpolateAngles(a2, a1, a3, m0));\n const H = quadrantShiftAngle(Theta - Lw - a);\n const dm = H / -360;\n return (m0 + dm) * 24;\n },\n\n correctedHourAngle: function(approximateTransit, angle, coordinates, afterTransit, siderealTime,\n rightAscension, previousRightAscension, nextRightAscension, declination, previousDeclination, nextDeclination) {\n const m0 = approximateTransit;\n const h0 = angle;\n const Theta0 = siderealTime;\n const a2 = rightAscension;\n const a1 = previousRightAscension;\n const a3 = nextRightAscension;\n const d2 = declination;\n const d1 = previousDeclination;\n const d3 = nextDeclination;\n\n /* Equation from page Astronomical Algorithms 102 */\n const Lw = coordinates.longitude * -1;\n const term1 = Math.sin(degreesToRadians(h0)) - (Math.sin(degreesToRadians(coordinates.latitude)) * Math.sin(degreesToRadians(d2)));\n const term2 = Math.cos(degreesToRadians(coordinates.latitude)) * Math.cos(degreesToRadians(d2));\n const H0 = radiansToDegrees(Math.acos(term1 / term2));\n const m = afterTransit ? m0 + (H0 / 360) : m0 - (H0 / 360);\n const Theta = unwindAngle((Theta0 + (360.985647 * m)));\n const a = unwindAngle(Astronomical.interpolateAngles(a2, a1, a3, m));\n const delta = Astronomical.interpolate(d2, d1, d3, m);\n const H = (Theta - Lw - a);\n const h = Astronomical.altitudeOfCelestialBody(coordinates.latitude, delta, H);\n const term3 = h - h0;\n const term4 = 360 * Math.cos(degreesToRadians(delta)) * Math.cos(degreesToRadians(coordinates.latitude)) * Math.sin(degreesToRadians(H));\n const dm = term3 / term4;\n return (m + dm) * 24;\n },\n\n /* Interpolation of a value given equidistant\n previous and next values and a factor\n equal to the fraction of the interpolated\n point's time over the time between values. */\n interpolate: function(y2, y1, y3, n) {\n /* Equation from Astronomical Algorithms page 24 */\n const a = y2 - y1;\n const b = y3 - y2;\n const c = b - a;\n return y2 + ((n/2) * (a + b + (n * c)));\n },\n\n /* Interpolation of three angles, accounting for\n angle unwinding. */\n interpolateAngles: function(y2, y1, y3, n) {\n /* Equation from Astronomical Algorithms page 24 */\n const a = unwindAngle(y2 - y1);\n const b = unwindAngle(y3 - y2);\n const c = b - a;\n return y2 + ((n/2) * (a + b + (n * c)));\n },\n\n /* The Julian Day for the given Gregorian date components. */\n julianDay: function(year, month, day, hours) {\n /* Equation from Astronomical Algorithms page 60 */\n if (typeof hours === 'undefined') {\n hours = 0;\n }\n\n const trunc = Math.trunc || function (x) { return x < 0 ? Math.ceil(x) : Math.floor(x); };\n\n const Y = trunc(month > 2 ? year : year - 1);\n const M = trunc(month > 2 ? month : month + 12);\n const D = day + (hours / 24);\n\n const A = trunc(Y/100);\n const B = trunc(2 - A + trunc(A/4));\n\n const i0 = trunc(365.25 * (Y + 4716));\n const i1 = trunc(30.6001 * (M + 1));\n\n return i0 + i1 + D + B - 1524.5;\n },\n\n /* Julian century from the epoch. */\n julianCentury: function(julianDay) {\n /* Equation from Astronomical Algorithms page 163 */\n return (julianDay - 2451545.0) / 36525;\n },\n\n /* Whether or not a year is a leap year (has 366 days). */\n isLeapYear: function(year) {\n if (year % 4 != 0) {\n return false;\n }\n\n if (year % 100 == 0 && year % 400 != 0) {\n return false;\n }\n\n return true;\n },\n\n seasonAdjustedMorningTwilight: function(latitude, dayOfYear, year, sunrise) {\n const a = 75 + ((28.65 / 55.0) * Math.abs(latitude));\n const b = 75 + ((19.44 / 55.0) * Math.abs(latitude));\n const c = 75 + ((32.74 / 55.0) * Math.abs(latitude));\n const d = 75 + ((48.10 / 55.0) * Math.abs(latitude));\n\n const adjustment = (function() {\n const dyy = Astronomical.daysSinceSolstice(dayOfYear, year, latitude);\n if ( dyy < 91) {\n return a + ( b - a ) / 91.0 * dyy;\n } else if ( dyy < 137) {\n return b + ( c - b ) / 46.0 * ( dyy - 91 );\n } else if ( dyy < 183 ) {\n return c + ( d - c ) / 46.0 * ( dyy - 137 );\n } else if ( dyy < 229 ) {\n return d + ( c - d ) / 46.0 * ( dyy - 183 );\n } else if ( dyy < 275 ) {\n return c + ( b - c ) / 46.0 * ( dyy - 229 );\n } else {\n return b + ( a - b ) / 91.0 * ( dyy - 275 );\n }\n })();\n\n return dateByAddingSeconds(sunrise, Math.round(adjustment * -60.0));\n },\n\n seasonAdjustedEveningTwilight: function(latitude, dayOfYear, year, sunset) {\n const a = 75 + ((25.60 / 55.0) * Math.abs(latitude));\n const b = 75 + ((2.050 / 55.0) * Math.abs(latitude));\n const c = 75 - ((9.210 / 55.0) * Math.abs(latitude));\n const d = 75 + ((6.140 / 55.0) * Math.abs(latitude));\n\n const adjustment = (function() {\n const dyy = Astronomical.daysSinceSolstice(dayOfYear, year, latitude);\n if ( dyy < 91) {\n return a + ( b - a ) / 91.0 * dyy;\n } else if ( dyy < 137) {\n return b + ( c - b ) / 46.0 * ( dyy - 91 );\n } else if ( dyy < 183 ) {\n return c + ( d - c ) / 46.0 * ( dyy - 137 );\n } else if ( dyy < 229 ) {\n return d + ( c - d ) / 46.0 * ( dyy - 183 );\n } else if ( dyy < 275 ) {\n return c + ( b - c ) / 46.0 * ( dyy - 229 );\n } else {\n return b + ( a - b ) / 91.0 * ( dyy - 275 );\n }\n })();\n\n return dateByAddingSeconds(sunset, Math.round(adjustment * 60.0));\n },\n\n daysSinceSolstice: function(dayOfYear, year, latitude) {\n let daysSinceSolstice = 0;\n const northernOffset = 10;\n const southernOffset = Astronomical.isLeapYear(year) ? 173 : 172;\n const daysInYear = Astronomical.isLeapYear(year) ? 366 : 365;\n\n if (latitude >= 0) {\n daysSinceSolstice = dayOfYear + northernOffset;\n if (daysSinceSolstice >= daysInYear) {\n daysSinceSolstice = daysSinceSolstice - daysInYear;\n }\n } else {\n daysSinceSolstice = dayOfYear - southernOffset;\n if (daysSinceSolstice < 0) {\n daysSinceSolstice = daysSinceSolstice + daysInYear;\n }\n }\n\n return daysSinceSolstice;\n }\n};\n\nexport default Astronomical;","import Astronomical from './Astronomical';\nimport { degreesToRadians, radiansToDegrees, unwindAngle } from './MathUtils';\n\nexport default class SolarCoordinates {\n constructor(julianDay) {\n const T = Astronomical.julianCentury(julianDay);\n const L0 = Astronomical.meanSolarLongitude(T);\n const Lp = Astronomical.meanLunarLongitude(T);\n const Omega = Astronomical.ascendingLunarNodeLongitude(T);\n const Lambda = degreesToRadians(Astronomical.apparentSolarLongitude(T, L0));\n const Theta0 = Astronomical.meanSiderealTime(T);\n const dPsi = Astronomical.nutationInLongitude(T, L0, Lp, Omega);\n const dEpsilon = Astronomical.nutationInObliquity(T, L0, Lp, Omega);\n const Epsilon0 = Astronomical.meanObliquityOfTheEcliptic(T);\n const EpsilonApparent = degreesToRadians(Astronomical.apparentObliquityOfTheEcliptic(T, Epsilon0));\n\n /* declination: The declination of the sun, the angle between\n the rays of the Sun and the plane of the Earth's\n equator, in degrees.\n Equation from Astronomical Algorithms page 165 */\n this.declination = radiansToDegrees(Math.asin(Math.sin(EpsilonApparent) * Math.sin(Lambda)));\n\n /* rightAscension: Right ascension of the Sun, the angular distance on the\n celestial equator from the vernal equinox to the hour circle,\n in degrees.\n Equation from Astronomical Algorithms page 165 */\n this.rightAscension = unwindAngle(radiansToDegrees(Math.atan2(Math.cos(EpsilonApparent) * Math.sin(Lambda), Math.cos(Lambda))));\n\n /* apparentSiderealTime: Apparent sidereal time, the hour angle of the vernal\n equinox, in degrees.\n Equation from Astronomical Algorithms page 88 */\n this.apparentSiderealTime = Theta0 + (((dPsi * 3600) * Math.cos(degreesToRadians(Epsilon0 + dEpsilon))) / 3600);\n }\n}\n\n","import Astronomical from './Astronomical';\nimport { degreesToRadians, radiansToDegrees } from './MathUtils'\nimport SolarCoordinates from './SolarCoordinates';\n\nexport default class SolarTime {\n constructor(date, coordinates) {\n const julianDay = Astronomical.julianDay(date.getFullYear(), date.getMonth() + 1, date.getDate(), 0);\n\n this.observer = coordinates;\n this.solar = new SolarCoordinates(julianDay);\n\n this.prevSolar = new SolarCoordinates(julianDay - 1);\n this.nextSolar = new SolarCoordinates(julianDay + 1);\n\n const m0 = Astronomical.approximateTransit(coordinates.longitude, this.solar.apparentSiderealTime, this.solar.rightAscension);\n const solarAltitude = -50.0 / 60.0;\n\n this.approxTransit = m0;\n\n this.transit = Astronomical.correctedTransit(m0, coordinates.longitude, this.solar.apparentSiderealTime, \n this.solar.rightAscension, this.prevSolar.rightAscension, this.nextSolar.rightAscension);\n\n this.sunrise = Astronomical.correctedHourAngle(m0, solarAltitude, coordinates, false, this.solar.apparentSiderealTime, \n this.solar.rightAscension, this.prevSolar.rightAscension, this.nextSolar.rightAscension, \n this.solar.declination, this.prevSolar.declination, this.nextSolar.declination);\n\n this.sunset = Astronomical.correctedHourAngle(m0, solarAltitude, coordinates, true, this.solar.apparentSiderealTime, \n this.solar.rightAscension, this.prevSolar.rightAscension, this.nextSolar.rightAscension, \n this.solar.declination, this.prevSolar.declination, this.nextSolar.declination);\n }\n\n hourAngle(angle, afterTransit) {\n return Astronomical.correctedHourAngle(this.approxTransit, angle, this.observer, afterTransit, this.solar.apparentSiderealTime, \n this.solar.rightAscension, this.prevSolar.rightAscension, this.nextSolar.rightAscension, \n this.solar.declination, this.prevSolar.declination, this.nextSolar.declination);\n }\n\n afternoon(shadowLength) {\n // TODO source shadow angle calculation\n const tangent = Math.abs(this.observer.latitude - this.solar.declination);\n const inverse = shadowLength + Math.tan(degreesToRadians(tangent));\n const angle = radiansToDegrees(Math.atan(1.0 / inverse));\n return this.hourAngle(angle, true);\n }\n}\n\n\n","export default class TimeComponents {\n constructor(number) {\n this.hours = Math.floor(number);\n this.minutes = Math.floor((number - this.hours) * 60);\n this.seconds = Math.floor((number - (this.hours + this.minutes / 60)) * 60 * 60);\n return this;\n }\n \n utcDate(year, month, date) {\n return new Date(Date.UTC(year, month, date, this.hours, this.minutes, this.seconds));\n }\n}\n","const Prayer = {\n Fajr: 'fajr',\n Sunrise: 'sunrise',\n Dhuhr: 'dhuhr',\n Asr: 'asr',\n Maghrib: 'maghrib',\n Isha: 'isha',\n None: 'none'\n};\n\nexport default Prayer;","export const Madhab = {\n Shafi: 'shafi',\n Hanafi: 'hanafi'\n};\n\nexport function shadowLength(madhab) {\n switch (madhab) {\n case Madhab.Shafi:\n return 1;\n case Madhab.Hanafi:\n return 2\n default:\n throw \"Invalid Madhab\";\n }\n}\n","import SolarTime from './SolarTime';\nimport TimeComponents from './TimeComponents';\nimport Prayer from './Prayer';\nimport Astronomical from './Astronomical';\nimport { dateByAddingDays, dateByAddingMinutes, dateByAddingSeconds, roundedMinute, dayOfYear } from './DateUtils';\nimport { Madhab, shadowLength } from './Madhab';\n\nexport default class PrayerTimes {\n constructor(coordinates, date, calculationParameters) {\n this.coordinates = coordinates;\n this.date = date;\n this.calculationParameters = calculationParameters;\n\n var solarTime = new SolarTime(date, coordinates);\n\n var fajrTime;\n var sunriseTime;\n var dhuhrTime;\n var asrTime;\n var maghribTime;\n var ishaTime;\n\n var nightFraction;\n\n dhuhrTime = new TimeComponents(solarTime.transit).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n sunriseTime = new TimeComponents(solarTime.sunrise).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n maghribTime = new TimeComponents(solarTime.sunset).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n\n asrTime = new TimeComponents(solarTime.afternoon(shadowLength(calculationParameters.madhab))).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n\n var tomorrow = dateByAddingDays(date, 1);\n var tomorrowSolarTime = new SolarTime(tomorrow, coordinates);\n var tomorrowSunrise = new TimeComponents(tomorrowSolarTime.sunrise).utcDate(tomorrow.getFullYear(), tomorrow.getMonth(), tomorrow.getDate());\n var night = (tomorrowSunrise - maghribTime) / 1000;\n\n fajrTime = new TimeComponents(solarTime.hourAngle(-1 * calculationParameters.fajrAngle, false)).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n\n // special case for moonsighting committee above latitude 55\n if (calculationParameters.method == \"MoonsightingCommittee\" && coordinates.latitude >= 55) {\n nightFraction = night / 7;\n fajrTime = dateByAddingSeconds(sunriseTime, -nightFraction);\n }\n\n var safeFajr = (function () {\n if (calculationParameters.method == \"MoonsightingCommittee\") {\n return Astronomical.seasonAdjustedMorningTwilight(coordinates.latitude, dayOfYear(date), date.getFullYear(), sunriseTime);\n }\n else {\n var portion = calculationParameters.nightPortions().fajr;\n nightFraction = portion * night;\n return dateByAddingSeconds(sunriseTime, -nightFraction);\n }\n })();\n\n if (fajrTime == null || isNaN(fajrTime.getTime()) || safeFajr > fajrTime) {\n fajrTime = safeFajr;\n }\n\n if (calculationParameters.ishaInterval > 0) {\n ishaTime = dateByAddingMinutes(maghribTime, calculationParameters.ishaInterval);\n } else {\n ishaTime = new TimeComponents(solarTime.hourAngle(-1 * calculationParameters.ishaAngle, true)).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n \n // special case for moonsighting committee above latitude 55\n if (calculationParameters.method == \"MoonsightingCommittee\" && coordinates.latitude >= 55) {\n nightFraction = night / 7;\n ishaTime = dateByAddingSeconds(maghribTime, nightFraction);\n }\n\n var safeIsha = (function () {\n if (calculationParameters.method == \"MoonsightingCommittee\") {\n return Astronomical.seasonAdjustedEveningTwilight(coordinates.latitude, dayOfYear(date), date.getFullYear(), maghribTime);\n }\n else {\n var portion = calculationParameters.nightPortions().isha;\n nightFraction = portion * night;\n return dateByAddingSeconds(maghribTime, nightFraction);\n }\n })();\n\n if (ishaTime == null || isNaN(ishaTime.getTime()) || safeIsha < ishaTime) {\n ishaTime = safeIsha;\n }\n }\n\n var fajrAdjustment = (calculationParameters.adjustments.fajr || 0) + (calculationParameters.methodAdjustments.fajr || 0);\n var sunriseAdjustment = (calculationParameters.adjustments.sunrise || 0) + (calculationParameters.methodAdjustments.sunrise || 0);\n var dhuhrAdjustment = (calculationParameters.adjustments.dhuhr || 0) + (calculationParameters.methodAdjustments.dhuhr || 0);\n var asrAdjustment = (calculationParameters.adjustments.asr || 0) + (calculationParameters.methodAdjustments.asr || 0);\n var maghribAdjustment = (calculationParameters.adjustments.maghrib || 0) + (calculationParameters.methodAdjustments.maghrib || 0);\n var ishaAdjustment = (calculationParameters.adjustments.isha || 0) + (calculationParameters.methodAdjustments.isha || 0);\n\n this.fajr = roundedMinute(dateByAddingMinutes(fajrTime, fajrAdjustment));\n this.sunrise = roundedMinute(dateByAddingMinutes(sunriseTime, sunriseAdjustment));\n this.dhuhr = roundedMinute(dateByAddingMinutes(dhuhrTime, dhuhrAdjustment));\n this.asr = roundedMinute(dateByAddingMinutes(asrTime, asrAdjustment));\n this.maghrib = roundedMinute(dateByAddingMinutes(maghribTime, maghribAdjustment));\n this.isha = roundedMinute(dateByAddingMinutes(ishaTime, ishaAdjustment));\n }\n\n timeForPrayer(prayer) {\n if (prayer == Prayer.Fajr) {\n return this.fajr;\n }\n else if (prayer == Prayer.Sunrise) {\n return this.sunrise;\n }\n else if (prayer == Prayer.Dhuhr) {\n return this.dhuhr;\n }\n else if (prayer == Prayer.Asr) {\n return this.asr;\n }\n else if (prayer == Prayer.Maghrib) {\n return this.maghrib;\n }\n else if (prayer == Prayer.Isha) {\n return this.isha;\n }\n else {\n return null;\n }\n }\n\n currentPrayer(date) {\n if (typeof date === 'undefined') {\n date = new Date();\n }\n if (date >= this.isha) {\n return Prayer.Isha;\n }\n else if (date >= this.maghrib) {\n return Prayer.Maghrib;\n }\n else if (date >= this.asr) {\n return Prayer.Asr;\n }\n else if (date >= this.dhuhr) {\n return Prayer.Dhuhr;\n }\n else if (date >= this.sunrise) {\n return Prayer.Sunrise;\n }\n else if (date >= this.fajr) {\n return Prayer.Fajr;\n }\n else {\n return Prayer.None;\n }\n }\n\n nextPrayer(date) {\n if (typeof date === 'undefined') {\n date = new Date();\n }\n if (date >= this.isha) {\n return Prayer.None;\n }\n else if (date >= this.maghrib) {\n return Prayer.Isha;\n }\n else if (date >= this.asr) {\n return Prayer.Maghrib;\n }\n else if (date >= this.dhuhr) {\n return Prayer.Asr;\n }\n else if (date >= this.sunrise) {\n return Prayer.Dhuhr;\n }\n else if (date >= this.fajr) {\n return Prayer.Sunrise;\n }\n else {\n return Prayer.Fajr;\n }\n }\n}\n\n","const HighLatitudeRule = {\n MiddleOfTheNight: 'middleofthenight',\n SeventhOfTheNight: 'seventhofthenight',\n TwilightAngle: 'twilightangle'\n};\n\nexport default HighLatitudeRule;","import { Madhab } from './Madhab';\nimport HighLatitudeRule from './HighLatitudeRule';\n\nexport default class CalculationParameters {\n constructor(fajrAngle, ishaAngle, ishaInterval, methodName) {\n this.method = methodName || \"Other\";\n this.fajrAngle = fajrAngle || 0;\n this.ishaAngle = ishaAngle || 0;\n this.ishaInterval = ishaInterval || 0;\n this.madhab = Madhab.Shafi;\n this.highLatitudeRule = HighLatitudeRule.MiddleOfTheNight;\n this.adjustments = { fajr: 0, sunrise: 0, dhuhr: 0, asr: 0, maghrib: 0, isha: 0 };\n this.methodAdjustments = { fajr: 0, sunrise: 0, dhuhr: 0, asr: 0, maghrib: 0, isha: 0 };\n }\n\n nightPortions() {\n switch (this.highLatitudeRule) {\n case HighLatitudeRule.MiddleOfTheNight:\n return { fajr: 1 / 2, isha: 1 / 2 };\n case HighLatitudeRule.SeventhOfTheNight:\n return { fajr: 1 / 7, isha: 1 / 7 };\n case HighLatitudeRule.TwilightAngle:\n return { fajr: this.fajrAngle / 60, isha: this.ishaAngle / 60 };\n default:\n throw(`Invalid high latitude rule found when attempting to compute night portions: ${this.highLatitudeRule}`);\n }\n }\n}\n","import CalculationParameters from './CalculationParameters';\n\nconst CalculationMethod = {\n // Muslim World League\n MuslimWorldLeague: function() {\n let params = new CalculationParameters(18, 17, 0, \"MuslimWorldLeague\");\n params.methodAdjustments = { dhuhr: 1 };\n return params;\n },\n\n // Egyptian General Authority of Survey\n Egyptian: function() {\n let params = new CalculationParameters(19.5, 17.5, 0, \"Egyptian\");\n params.methodAdjustments = { dhuhr: 1 };\n return params;\n },\n\n // University of Islamic Sciences, Karachi\n Karachi: function() {\n let params = new CalculationParameters(18, 18, 0, \"Karachi\");\n params.methodAdjustments = { dhuhr: 1 };\n return params;\n },\n\n // Umm al-Qura University, Makkah\n UmmAlQura: function() {\n return new CalculationParameters(18.5, 0, 90, \"UmmAlQura\");\n },\n\n // Dubai\n Dubai: function() {\n let params = new CalculationParameters(18.2, 18.2, 0, \"Dubai\");\n params.methodAdjustments = { sunrise: -3, dhuhr: 3, asr: 3, maghrib: 3 };\n return params;\n },\n\n // Moonsighting Committee\n MoonsightingCommittee: function() {\n let params = new CalculationParameters(18, 18, 0, \"MoonsightingCommittee\");\n params.methodAdjustments = { dhuhr: 5, maghrib: 3 };\n return params;\n },\n\n // ISNA\n NorthAmerica: function() {\n let params = new CalculationParameters(15, 15, 0, \"NorthAmerica\");\n params.methodAdjustments = { dhuhr: 1 };\n return params;\n },\n\n // Kuwait\n Kuwait: function() {\n return new CalculationParameters(18, 17.5, 0, \"Kuwait\");\n },\n\n // Qatar\n Qatar: function() {\n return new CalculationParameters(18, 0, 90, \"Qatar\");\n },\n\n // Singapore\n Singapore: function() {\n let params = new CalculationParameters(20, 18, 0, \"Singapore\");\n params.methodAdjustments = { dhuhr: 1 };\n return params;\n },\n\n // Other\n Other: function() {\n return new CalculationParameters(0, 0, 0, \"Other\");\n }\n};\n\nexport default CalculationMethod;","import Coordinates from './Coordinates'\nimport { degreesToRadians, radiansToDegrees, unwindAngle } from './MathUtils'\n\nexport default function qibla(coordinates) {\n const makkah = new Coordinates(21.4225241, 39.8261818);\n\n // Equation from \"Spherical Trigonometry For the use of colleges and schools\" page 50\n const term1 = (\n Math.sin(degreesToRadians(makkah.longitude) -\n degreesToRadians(coordinates.longitude))\n );\n const term2 = (\n Math.cos(degreesToRadians(coordinates.latitude)) *\n Math.tan(degreesToRadians(makkah.latitude))\n );\n const term3 = (\n Math.sin(degreesToRadians(coordinates.latitude)) *\n Math.cos(degreesToRadians(makkah.longitude) -\n degreesToRadians(coordinates.longitude))\n );\n const angle = Math.atan2(term1, term2 - term3);\n\n return unwindAngle(radiansToDegrees(angle));\n}\n","import { dateByAddingDays, dateByAddingSeconds, roundedMinute } from './DateUtils';\nimport PrayerTimes from './PrayerTimes';\n\nexport default class SunnahTimes {\n constructor(prayerTimes) {\n const date = prayerTimes.date;\n const nextDay = dateByAddingDays(date, 1);\n const nextDayPrayerTimes = new PrayerTimes(prayerTimes.coordinates, nextDay, prayerTimes.calculationParameters);\n\n const nightDuration = (nextDayPrayerTimes.fajr.getTime() - prayerTimes.maghrib.getTime()) / 1000.0;\n\n this.middleOfTheNight = roundedMinute(dateByAddingSeconds(prayerTimes.maghrib, nightDuration / 2));\n this.lastThirdOfTheNight = roundedMinute(dateByAddingSeconds(prayerTimes.maghrib, nightDuration * (2 / 3)));\n }\n}\n\n","import Coordinates from './Coordinates';\nimport PrayerTimes from './PrayerTimes';\nimport Prayer from './Prayer';\nimport { Madhab } from './Madhab';\nimport HighLatitudeRule from './HighLatitudeRule';\nimport CalculationMethod from './CalculationMethod';\nimport CalculationParameters from './CalculationParameters';\nimport qibla from './Qibla';\nimport SunnahTimes from './SunnahTimes';\n\nconst adhan = {\n Prayer: Prayer,\n Madhab: Madhab,\n HighLatitudeRule: HighLatitudeRule,\n Coordinates: Coordinates,\n CalculationParameters: CalculationParameters,\n CalculationMethod: CalculationMethod,\n PrayerTimes: PrayerTimes,\n SunnahTimes: SunnahTimes,\n Qibla: qibla\n};\n\nexport default adhan;"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://adhan/webpack/universalModuleDefinition","webpack://adhan/webpack/bootstrap","webpack://adhan/./src/Coordinates.js","webpack://adhan/./src/MathUtils.js","webpack://adhan/./src/DateUtils.js","webpack://adhan/./src/Astronomical.js","webpack://adhan/./src/SolarCoordinates.js","webpack://adhan/./src/SolarTime.js","webpack://adhan/./src/TimeComponents.js","webpack://adhan/./src/Prayer.js","webpack://adhan/./src/Madhab.js","webpack://adhan/./src/PrayerTimes.js","webpack://adhan/./src/HighLatitudeRule.js","webpack://adhan/./src/CalculationParameters.js","webpack://adhan/./src/CalculationMethod.js","webpack://adhan/./src/Qibla.js","webpack://adhan/./src/SunnahTimes.js","webpack://adhan/./src/Adhan.js"],"names":["Coordinates","constructor","latitude","longitude","degreesToRadians","degrees","Math","PI","radiansToDegrees","radians","normalizeToScale","number","max","floor","unwindAngle","angle","quadrantShiftAngle","round","dateByAddingDays","date","days","year","getFullYear","month","getMonth","day","getDate","hours","getHours","minutes","getMinutes","seconds","getSeconds","Date","dateByAddingMinutes","dateByAddingSeconds","getTime","roundedMinute","getUTCSeconds","offset","dayOfYear","returnedDayOfYear","feb","Astronomical","isLeapYear","months","i","meanSolarLongitude","julianCentury","T","term1","term2","term3","pow","L0","meanLunarLongitude","Lp","ascendingLunarNodeLongitude","term4","Omega","meanSolarAnomaly","M","solarEquationOfTheCenter","meanAnomaly","Mrad","sin","apparentSolarLongitude","meanLongitude","Lambda","meanObliquityOfTheEcliptic","apparentObliquityOfTheEcliptic","Epsilon0","O","cos","meanSiderealTime","JD","Theta","nutationInLongitude","solarLongitude","lunarLongitude","ascendingNode","nutationInObliquity","altitudeOfCelestialBody","observerLatitude","declination","localHourAngle","Phi","delta","H","asin","approximateTransit","siderealTime","rightAscension","L","Theta0","a2","Lw","correctedTransit","previousRightAscension","nextRightAscension","m0","a1","a3","a","interpolateAngles","dm","correctedHourAngle","coordinates","afterTransit","previousDeclination","nextDeclination","h0","d2","d1","d3","H0","acos","m","interpolate","h","y2","y1","y3","n","b","c","julianDay","trunc","x","ceil","Y","D","A","B","i0","i1","seasonAdjustedMorningTwilight","sunrise","abs","d","adjustment","dyy","daysSinceSolstice","seasonAdjustedEveningTwilight","sunset","northernOffset","southernOffset","daysInYear","SolarCoordinates","dPsi","dEpsilon","EpsilonApparent","atan2","apparentSiderealTime","SolarTime","observer","solar","prevSolar","nextSolar","solarAltitude","approxTransit","transit","hourAngle","afternoon","shadowLength","tangent","inverse","tan","atan","TimeComponents","utcDate","UTC","Prayer","Fajr","Sunrise","Dhuhr","Asr","Maghrib","Isha","None","Madhab","Shafi","Hanafi","madhab","PrayerTimes","calculationParameters","solarTime","fajrTime","sunriseTime","dhuhrTime","asrTime","maghribTime","ishaTime","nightFraction","sunsetTime","tomorrow","tomorrowSolarTime","tomorrowSunrise","night","fajrAngle","method","safeFajr","portion","nightPortions","fajr","isNaN","ishaInterval","ishaAngle","safeIsha","isha","maghribAngle","angleBasedMaghrib","fajrAdjustment","adjustments","methodAdjustments","sunriseAdjustment","dhuhrAdjustment","dhuhr","asrAdjustment","asr","maghribAdjustment","maghrib","ishaAdjustment","timeForPrayer","prayer","currentPrayer","nextPrayer","HighLatitudeRule","MiddleOfTheNight","SeventhOfTheNight","TwilightAngle","CalculationParameters","methodName","highLatitudeRule","CalculationMethod","MuslimWorldLeague","params","Egyptian","Karachi","UmmAlQura","Dubai","MoonsightingCommittee","NorthAmerica","Kuwait","Qatar","Singapore","Tehran","Turkey","Other","qibla","makkah","SunnahTimes","prayerTimes","nextDay","nextDayPrayerTimes","nightDuration","middleOfTheNight","lastThirdOfTheNight","adhan","Qibla"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,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/B,OAAZ,CAAoBzL,OAApB,EAArC,IAAsE,MAA5F;AAEA,SAAK4N,gBAAL,GAAwB3N,aAAa,CAACF,mBAAmB,CAACyN,WAAW,CAAC/B,OAAb,EAAsBkC,aAAa,GAAG,CAAtC,CAApB,CAArC;AACA,SAAKE,mBAAL,GAA2B5N,aAAa,CAACF,mBAAmB,CAACyN,WAAW,CAAC/B,OAAb,EAAsBkC,aAAa,IAAI,IAAI,CAAR,CAAnC,CAApB,CAAxC;AACH;;AAV4B,C;;ACHjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMG,KAAK,GAAG;AACVtF,QAAM,EAAEA,UADE;AAEVQ,QAAM,EAAEA,MAFE;AAGV+C,kBAAgB,EAAEA,oBAHR;AAIVnO,aAAW,EAAEA,WAJH;AAKVuO,uBAAqB,EAAEA,2CALb;AAMVG,mBAAiB,EAAEA,qBANT;AAOVlD,aAAW,EAAEA,uBAPH;AAQVmE,aAAW,EAAEA,uBARH;AASVQ,OAAK,EAAEV,KAAKA;AATF,CAAd;AAYeS,gFAAf,E","file":"Adhan.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"adhan\"] = factory();\n\telse\n\t\troot[\"adhan\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","export default class Coordinates {\n constructor(latitude, longitude) {\n this.latitude = latitude;\n this.longitude = longitude;\n }\n}\n","export function degreesToRadians(degrees) {\n return (degrees * Math.PI) / 180.0;\n}\n\nexport function radiansToDegrees(radians) {\n return (radians * 180.0) / Math.PI;\n}\n\nexport function normalizeToScale(number, max) {\n return number - (max * (Math.floor(number / max)))\n}\n\nexport function unwindAngle(angle) {\n return normalizeToScale(angle, 360.0);\n}\n\nexport function quadrantShiftAngle(angle) {\n if (angle >= -180 && angle <= 180) {\n return angle;\n }\n\n return angle - (360 * Math.round(angle/360));\n}\n","import Astronomical from './Astronomical';\n\nexport function dateByAddingDays(date, days) {\n const year = date.getFullYear();\n const month = date.getMonth();\n const day = date.getDate() + days;\n const hours = date.getHours();\n const minutes = date.getMinutes();\n const seconds = date.getSeconds();\n return new Date(year, month, day, hours, minutes, seconds);\n}\n\nexport function dateByAddingMinutes(date, minutes) {\n return dateByAddingSeconds(date, minutes * 60);\n}\n\nexport function dateByAddingSeconds(date, seconds) {\n return new Date(date.getTime() + (seconds * 1000));\n}\n\nexport function roundedMinute(date) {\n const seconds = date.getUTCSeconds();\n const offset = seconds >= 30 ? 60 - seconds : -1 * seconds;\n return dateByAddingSeconds(date, offset);\n}\n\nexport function dayOfYear(date) {\n let returnedDayOfYear = 0;\n const feb = Astronomical.isLeapYear(date.getFullYear()) ? 29 : 28;\n const months = [31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n for (let i = 0; i < date.getMonth(); i++) {\n returnedDayOfYear += months[i];\n }\n\n returnedDayOfYear += date.getDate();\n\n return returnedDayOfYear;\n}\n","import { degreesToRadians, radiansToDegrees, unwindAngle, normalizeToScale, quadrantShiftAngle } from './MathUtils';\nimport { dateByAddingSeconds } from './DateUtils';\n\nconst Astronomical = {\n\n /* The geometric mean longitude of the sun in degrees. */\n meanSolarLongitude: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 163 */\n const term1 = 280.4664567;\n const term2 = 36000.76983 * T;\n const term3 = 0.0003032 * Math.pow(T, 2);\n const L0 = term1 + term2 + term3;\n return unwindAngle(L0);\n },\n\n /* The geometric mean longitude of the moon in degrees. */\n meanLunarLongitude: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 144 */\n const term1 = 218.3165;\n const term2 = 481267.8813 * T;\n const Lp = term1 + term2;\n return unwindAngle(Lp);\n },\n\n ascendingLunarNodeLongitude: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 144 */\n const term1 = 125.04452;\n const term2 = 1934.136261 * T;\n const term3 = 0.0020708 * Math.pow(T, 2);\n const term4 = Math.pow(T, 3) / 450000;\n const Omega = term1 - term2 + term3 + term4;\n return unwindAngle(Omega);\n },\n\n /* The mean anomaly of the sun. */\n meanSolarAnomaly: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 163 */\n const term1 = 357.52911;\n const term2 = 35999.05029 * T;\n const term3 = 0.0001537 * Math.pow(T, 2);\n const M = term1 + term2 - term3;\n return unwindAngle(M);\n },\n\n /* The Sun's equation of the center in degrees. */\n solarEquationOfTheCenter: function(julianCentury, meanAnomaly) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 164 */\n const Mrad = degreesToRadians(meanAnomaly);\n const term1 = (1.914602 - (0.004817 * T) - (0.000014 * Math.pow(T, 2))) * Math.sin(Mrad);\n const term2 = (0.019993 - (0.000101 * T)) * Math.sin(2 * Mrad);\n const term3 = 0.000289 * Math.sin(3 * Mrad);\n return term1 + term2 + term3;\n },\n\n /* The apparent longitude of the Sun, referred to the\n true equinox of the date. */\n apparentSolarLongitude: function(julianCentury, meanLongitude) {\n const T = julianCentury;\n const L0 = meanLongitude;\n /* Equation from Astronomical Algorithms page 164 */\n const longitude = L0 + Astronomical.solarEquationOfTheCenter(T, Astronomical.meanSolarAnomaly(T));\n const Omega = 125.04 - (1934.136 * T);\n const Lambda = longitude - 0.00569 - (0.00478 * Math.sin(degreesToRadians(Omega)));\n return unwindAngle(Lambda);\n },\n\n /* The mean obliquity of the ecliptic, formula\n adopted by the International Astronomical Union.\n Represented in degrees. */\n meanObliquityOfTheEcliptic: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 147 */\n const term1 = 23.439291;\n const term2 = 0.013004167 * T;\n const term3 = 0.0000001639 * Math.pow(T, 2);\n const term4 = 0.0000005036 * Math.pow(T, 3);\n return term1 - term2 - term3 + term4;\n },\n\n /* The mean obliquity of the ecliptic, corrected for\n calculating the apparent position of the sun, in degrees. */\n apparentObliquityOfTheEcliptic: function(julianCentury, meanObliquityOfTheEcliptic) {\n const T = julianCentury;\n const Epsilon0 = meanObliquityOfTheEcliptic;\n /* Equation from Astronomical Algorithms page 165 */\n const O = 125.04 - (1934.136 * T);\n return Epsilon0 + (0.00256 * Math.cos(degreesToRadians(O)));\n },\n\n /* Mean sidereal time, the hour angle of the vernal equinox, in degrees. */\n meanSiderealTime: function(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 165 */\n const JD = (T * 36525) + 2451545.0;\n const term1 = 280.46061837;\n const term2 = 360.98564736629 * (JD - 2451545);\n const term3 = 0.000387933 * Math.pow(T, 2);\n const term4 = Math.pow(T, 3) / 38710000;\n const Theta = term1 + term2 + term3 - term4;\n return unwindAngle(Theta)\n },\n\n nutationInLongitude: function(julianCentury, solarLongitude, lunarLongitude, ascendingNode) {\n const L0 = solarLongitude;\n const Lp = lunarLongitude;\n const Omega = ascendingNode;\n /* Equation from Astronomical Algorithms page 144 */\n const term1 = (-17.2/3600) * Math.sin(degreesToRadians(Omega));\n const term2 = (1.32/3600) * Math.sin(2 * degreesToRadians(L0));\n const term3 = (0.23/3600) * Math.sin(2 * degreesToRadians(Lp));\n const term4 = (0.21/3600) * Math.sin(2 * degreesToRadians(Omega));\n return term1 - term2 - term3 + term4;\n },\n\n nutationInObliquity: function(julianCentury, solarLongitude, lunarLongitude, ascendingNode) {\n const L0 = solarLongitude;\n const Lp = lunarLongitude;\n const Omega = ascendingNode;\n /* Equation from Astronomical Algorithms page 144 */\n const term1 = (9.2/3600) * Math.cos(degreesToRadians(Omega));\n const term2 = (0.57/3600) * Math.cos(2 * degreesToRadians(L0));\n const term3 = (0.10/3600) * Math.cos(2 * degreesToRadians(Lp));\n const term4 = (0.09/3600) * Math.cos(2 * degreesToRadians(Omega));\n return term1 + term2 + term3 - term4;\n },\n\n altitudeOfCelestialBody: function(observerLatitude, declination, localHourAngle) {\n const Phi = observerLatitude;\n const delta = declination;\n const H = localHourAngle;\n /* Equation from Astronomical Algorithms page 93 */\n const term1 = Math.sin(degreesToRadians(Phi)) * Math.sin(degreesToRadians(delta));\n const term2 = Math.cos(degreesToRadians(Phi)) * Math.cos(degreesToRadians(delta)) * Math.cos(degreesToRadians(H));\n return radiansToDegrees(Math.asin(term1 + term2));\n },\n\n approximateTransit: function(longitude, siderealTime, rightAscension) {\n const L = longitude;\n const Theta0 = siderealTime;\n const a2 = rightAscension;\n /* Equation from page Astronomical Algorithms 102 */\n const Lw = L * -1;\n return normalizeToScale((a2 + Lw - Theta0) / 360, 1);\n },\n\n /* The time at which the sun is at its highest point in the sky (in universal time) */\n correctedTransit: function(approximateTransit, longitude, siderealTime, rightAscension, previousRightAscension, nextRightAscension) {\n const m0 = approximateTransit;\n const L = longitude;\n const Theta0 = siderealTime;\n const a2 = rightAscension;\n const a1 = previousRightAscension;\n const a3 = nextRightAscension;\n /* Equation from page Astronomical Algorithms 102 */\n const Lw = L * -1;\n const Theta = unwindAngle((Theta0 + (360.985647 * m0)));\n const a = unwindAngle(Astronomical.interpolateAngles(a2, a1, a3, m0));\n const H = quadrantShiftAngle(Theta - Lw - a);\n const dm = H / -360;\n return (m0 + dm) * 24;\n },\n\n correctedHourAngle: function(approximateTransit, angle, coordinates, afterTransit, siderealTime,\n rightAscension, previousRightAscension, nextRightAscension, declination, previousDeclination, nextDeclination) {\n const m0 = approximateTransit;\n const h0 = angle;\n const Theta0 = siderealTime;\n const a2 = rightAscension;\n const a1 = previousRightAscension;\n const a3 = nextRightAscension;\n const d2 = declination;\n const d1 = previousDeclination;\n const d3 = nextDeclination;\n\n /* Equation from page Astronomical Algorithms 102 */\n const Lw = coordinates.longitude * -1;\n const term1 = Math.sin(degreesToRadians(h0)) - (Math.sin(degreesToRadians(coordinates.latitude)) * Math.sin(degreesToRadians(d2)));\n const term2 = Math.cos(degreesToRadians(coordinates.latitude)) * Math.cos(degreesToRadians(d2));\n const H0 = radiansToDegrees(Math.acos(term1 / term2));\n const m = afterTransit ? m0 + (H0 / 360) : m0 - (H0 / 360);\n const Theta = unwindAngle((Theta0 + (360.985647 * m)));\n const a = unwindAngle(Astronomical.interpolateAngles(a2, a1, a3, m));\n const delta = Astronomical.interpolate(d2, d1, d3, m);\n const H = (Theta - Lw - a);\n const h = Astronomical.altitudeOfCelestialBody(coordinates.latitude, delta, H);\n const term3 = h - h0;\n const term4 = 360 * Math.cos(degreesToRadians(delta)) * Math.cos(degreesToRadians(coordinates.latitude)) * Math.sin(degreesToRadians(H));\n const dm = term3 / term4;\n return (m + dm) * 24;\n },\n\n /* Interpolation of a value given equidistant\n previous and next values and a factor\n equal to the fraction of the interpolated\n point's time over the time between values. */\n interpolate: function(y2, y1, y3, n) {\n /* Equation from Astronomical Algorithms page 24 */\n const a = y2 - y1;\n const b = y3 - y2;\n const c = b - a;\n return y2 + ((n/2) * (a + b + (n * c)));\n },\n\n /* Interpolation of three angles, accounting for\n angle unwinding. */\n interpolateAngles: function(y2, y1, y3, n) {\n /* Equation from Astronomical Algorithms page 24 */\n const a = unwindAngle(y2 - y1);\n const b = unwindAngle(y3 - y2);\n const c = b - a;\n return y2 + ((n/2) * (a + b + (n * c)));\n },\n\n /* The Julian Day for the given Gregorian date components. */\n julianDay: function(year, month, day, hours) {\n /* Equation from Astronomical Algorithms page 60 */\n if (typeof hours === 'undefined') {\n hours = 0;\n }\n\n const trunc = Math.trunc || function (x) { return x < 0 ? Math.ceil(x) : Math.floor(x); };\n\n const Y = trunc(month > 2 ? year : year - 1);\n const M = trunc(month > 2 ? month : month + 12);\n const D = day + (hours / 24);\n\n const A = trunc(Y/100);\n const B = trunc(2 - A + trunc(A/4));\n\n const i0 = trunc(365.25 * (Y + 4716));\n const i1 = trunc(30.6001 * (M + 1));\n\n return i0 + i1 + D + B - 1524.5;\n },\n\n /* Julian century from the epoch. */\n julianCentury: function(julianDay) {\n /* Equation from Astronomical Algorithms page 163 */\n return (julianDay - 2451545.0) / 36525;\n },\n\n /* Whether or not a year is a leap year (has 366 days). */\n isLeapYear: function(year) {\n if (year % 4 != 0) {\n return false;\n }\n\n if (year % 100 == 0 && year % 400 != 0) {\n return false;\n }\n\n return true;\n },\n\n seasonAdjustedMorningTwilight: function(latitude, dayOfYear, year, sunrise) {\n const a = 75 + ((28.65 / 55.0) * Math.abs(latitude));\n const b = 75 + ((19.44 / 55.0) * Math.abs(latitude));\n const c = 75 + ((32.74 / 55.0) * Math.abs(latitude));\n const d = 75 + ((48.10 / 55.0) * Math.abs(latitude));\n\n const adjustment = (function() {\n const dyy = Astronomical.daysSinceSolstice(dayOfYear, year, latitude);\n if ( dyy < 91) {\n return a + ( b - a ) / 91.0 * dyy;\n } else if ( dyy < 137) {\n return b + ( c - b ) / 46.0 * ( dyy - 91 );\n } else if ( dyy < 183 ) {\n return c + ( d - c ) / 46.0 * ( dyy - 137 );\n } else if ( dyy < 229 ) {\n return d + ( c - d ) / 46.0 * ( dyy - 183 );\n } else if ( dyy < 275 ) {\n return c + ( b - c ) / 46.0 * ( dyy - 229 );\n } else {\n return b + ( a - b ) / 91.0 * ( dyy - 275 );\n }\n })();\n\n return dateByAddingSeconds(sunrise, Math.round(adjustment * -60.0));\n },\n\n seasonAdjustedEveningTwilight: function(latitude, dayOfYear, year, sunset) {\n const a = 75 + ((25.60 / 55.0) * Math.abs(latitude));\n const b = 75 + ((2.050 / 55.0) * Math.abs(latitude));\n const c = 75 - ((9.210 / 55.0) * Math.abs(latitude));\n const d = 75 + ((6.140 / 55.0) * Math.abs(latitude));\n\n const adjustment = (function() {\n const dyy = Astronomical.daysSinceSolstice(dayOfYear, year, latitude);\n if ( dyy < 91) {\n return a + ( b - a ) / 91.0 * dyy;\n } else if ( dyy < 137) {\n return b + ( c - b ) / 46.0 * ( dyy - 91 );\n } else if ( dyy < 183 ) {\n return c + ( d - c ) / 46.0 * ( dyy - 137 );\n } else if ( dyy < 229 ) {\n return d + ( c - d ) / 46.0 * ( dyy - 183 );\n } else if ( dyy < 275 ) {\n return c + ( b - c ) / 46.0 * ( dyy - 229 );\n } else {\n return b + ( a - b ) / 91.0 * ( dyy - 275 );\n }\n })();\n\n return dateByAddingSeconds(sunset, Math.round(adjustment * 60.0));\n },\n\n daysSinceSolstice: function(dayOfYear, year, latitude) {\n let daysSinceSolstice = 0;\n const northernOffset = 10;\n const southernOffset = Astronomical.isLeapYear(year) ? 173 : 172;\n const daysInYear = Astronomical.isLeapYear(year) ? 366 : 365;\n\n if (latitude >= 0) {\n daysSinceSolstice = dayOfYear + northernOffset;\n if (daysSinceSolstice >= daysInYear) {\n daysSinceSolstice = daysSinceSolstice - daysInYear;\n }\n } else {\n daysSinceSolstice = dayOfYear - southernOffset;\n if (daysSinceSolstice < 0) {\n daysSinceSolstice = daysSinceSolstice + daysInYear;\n }\n }\n\n return daysSinceSolstice;\n }\n};\n\nexport default Astronomical;","import Astronomical from './Astronomical';\nimport { degreesToRadians, radiansToDegrees, unwindAngle } from './MathUtils';\n\nexport default class SolarCoordinates {\n constructor(julianDay) {\n const T = Astronomical.julianCentury(julianDay);\n const L0 = Astronomical.meanSolarLongitude(T);\n const Lp = Astronomical.meanLunarLongitude(T);\n const Omega = Astronomical.ascendingLunarNodeLongitude(T);\n const Lambda = degreesToRadians(Astronomical.apparentSolarLongitude(T, L0));\n const Theta0 = Astronomical.meanSiderealTime(T);\n const dPsi = Astronomical.nutationInLongitude(T, L0, Lp, Omega);\n const dEpsilon = Astronomical.nutationInObliquity(T, L0, Lp, Omega);\n const Epsilon0 = Astronomical.meanObliquityOfTheEcliptic(T);\n const EpsilonApparent = degreesToRadians(Astronomical.apparentObliquityOfTheEcliptic(T, Epsilon0));\n\n /* declination: The declination of the sun, the angle between\n the rays of the Sun and the plane of the Earth's\n equator, in degrees.\n Equation from Astronomical Algorithms page 165 */\n this.declination = radiansToDegrees(Math.asin(Math.sin(EpsilonApparent) * Math.sin(Lambda)));\n\n /* rightAscension: Right ascension of the Sun, the angular distance on the\n celestial equator from the vernal equinox to the hour circle,\n in degrees.\n Equation from Astronomical Algorithms page 165 */\n this.rightAscension = unwindAngle(radiansToDegrees(Math.atan2(Math.cos(EpsilonApparent) * Math.sin(Lambda), Math.cos(Lambda))));\n\n /* apparentSiderealTime: Apparent sidereal time, the hour angle of the vernal\n equinox, in degrees.\n Equation from Astronomical Algorithms page 88 */\n this.apparentSiderealTime = Theta0 + (((dPsi * 3600) * Math.cos(degreesToRadians(Epsilon0 + dEpsilon))) / 3600);\n }\n}\n\n","import Astronomical from './Astronomical';\nimport { degreesToRadians, radiansToDegrees } from './MathUtils'\nimport SolarCoordinates from './SolarCoordinates';\n\nexport default class SolarTime {\n constructor(date, coordinates) {\n const julianDay = Astronomical.julianDay(date.getFullYear(), date.getMonth() + 1, date.getDate(), 0);\n\n this.observer = coordinates;\n this.solar = new SolarCoordinates(julianDay);\n\n this.prevSolar = new SolarCoordinates(julianDay - 1);\n this.nextSolar = new SolarCoordinates(julianDay + 1);\n\n const m0 = Astronomical.approximateTransit(coordinates.longitude, this.solar.apparentSiderealTime, this.solar.rightAscension);\n const solarAltitude = -50.0 / 60.0;\n\n this.approxTransit = m0;\n\n this.transit = Astronomical.correctedTransit(m0, coordinates.longitude, this.solar.apparentSiderealTime, \n this.solar.rightAscension, this.prevSolar.rightAscension, this.nextSolar.rightAscension);\n\n this.sunrise = Astronomical.correctedHourAngle(m0, solarAltitude, coordinates, false, this.solar.apparentSiderealTime, \n this.solar.rightAscension, this.prevSolar.rightAscension, this.nextSolar.rightAscension, \n this.solar.declination, this.prevSolar.declination, this.nextSolar.declination);\n\n this.sunset = Astronomical.correctedHourAngle(m0, solarAltitude, coordinates, true, this.solar.apparentSiderealTime, \n this.solar.rightAscension, this.prevSolar.rightAscension, this.nextSolar.rightAscension, \n this.solar.declination, this.prevSolar.declination, this.nextSolar.declination);\n }\n\n hourAngle(angle, afterTransit) {\n return Astronomical.correctedHourAngle(this.approxTransit, angle, this.observer, afterTransit, this.solar.apparentSiderealTime, \n this.solar.rightAscension, this.prevSolar.rightAscension, this.nextSolar.rightAscension, \n this.solar.declination, this.prevSolar.declination, this.nextSolar.declination);\n }\n\n afternoon(shadowLength) {\n // TODO source shadow angle calculation\n const tangent = Math.abs(this.observer.latitude - this.solar.declination);\n const inverse = shadowLength + Math.tan(degreesToRadians(tangent));\n const angle = radiansToDegrees(Math.atan(1.0 / inverse));\n return this.hourAngle(angle, true);\n }\n}\n\n\n","export default class TimeComponents {\n constructor(number) {\n this.hours = Math.floor(number);\n this.minutes = Math.floor((number - this.hours) * 60);\n this.seconds = Math.floor((number - (this.hours + this.minutes / 60)) * 60 * 60);\n return this;\n }\n \n utcDate(year, month, date) {\n return new Date(Date.UTC(year, month, date, this.hours, this.minutes, this.seconds));\n }\n}\n","const Prayer = {\n Fajr: 'fajr',\n Sunrise: 'sunrise',\n Dhuhr: 'dhuhr',\n Asr: 'asr',\n Maghrib: 'maghrib',\n Isha: 'isha',\n None: 'none'\n};\n\nexport default Prayer;","export const Madhab = {\n Shafi: 'shafi',\n Hanafi: 'hanafi'\n};\n\nexport function shadowLength(madhab) {\n switch (madhab) {\n case Madhab.Shafi:\n return 1;\n case Madhab.Hanafi:\n return 2\n default:\n throw \"Invalid Madhab\";\n }\n}\n","import SolarTime from './SolarTime';\nimport TimeComponents from './TimeComponents';\nimport Prayer from './Prayer';\nimport Astronomical from './Astronomical';\nimport { dateByAddingDays, dateByAddingMinutes, dateByAddingSeconds, roundedMinute, dayOfYear } from './DateUtils';\nimport { Madhab, shadowLength } from './Madhab';\n\nexport default class PrayerTimes {\n constructor(coordinates, date, calculationParameters) {\n this.coordinates = coordinates;\n this.date = date;\n this.calculationParameters = calculationParameters;\n\n var solarTime = new SolarTime(date, coordinates);\n\n var fajrTime;\n var sunriseTime;\n var dhuhrTime;\n var asrTime;\n var maghribTime;\n var ishaTime;\n\n var nightFraction;\n\n dhuhrTime = new TimeComponents(solarTime.transit).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n sunriseTime = new TimeComponents(solarTime.sunrise).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n var sunsetTime = new TimeComponents(solarTime.sunset).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n\n asrTime = new TimeComponents(solarTime.afternoon(shadowLength(calculationParameters.madhab))).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n\n var tomorrow = dateByAddingDays(date, 1);\n var tomorrowSolarTime = new SolarTime(tomorrow, coordinates);\n var tomorrowSunrise = new TimeComponents(tomorrowSolarTime.sunrise).utcDate(tomorrow.getFullYear(), tomorrow.getMonth(), tomorrow.getDate());\n var night = (tomorrowSunrise - sunsetTime) / 1000;\n\n fajrTime = new TimeComponents(solarTime.hourAngle(-1 * calculationParameters.fajrAngle, false)).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n\n // special case for moonsighting committee above latitude 55\n if (calculationParameters.method == \"MoonsightingCommittee\" && coordinates.latitude >= 55) {\n nightFraction = night / 7;\n fajrTime = dateByAddingSeconds(sunriseTime, -nightFraction);\n }\n\n var safeFajr = (function () {\n if (calculationParameters.method == \"MoonsightingCommittee\") {\n return Astronomical.seasonAdjustedMorningTwilight(coordinates.latitude, dayOfYear(date), date.getFullYear(), sunriseTime);\n }\n else {\n var portion = calculationParameters.nightPortions().fajr;\n nightFraction = portion * night;\n return dateByAddingSeconds(sunriseTime, -nightFraction);\n }\n })();\n\n if (fajrTime == null || isNaN(fajrTime.getTime()) || safeFajr > fajrTime) {\n fajrTime = safeFajr;\n }\n\n if (calculationParameters.ishaInterval > 0) {\n ishaTime = dateByAddingMinutes(sunsetTime, calculationParameters.ishaInterval);\n } else {\n ishaTime = new TimeComponents(solarTime.hourAngle(-1 * calculationParameters.ishaAngle, true)).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n \n // special case for moonsighting committee above latitude 55\n if (calculationParameters.method == \"MoonsightingCommittee\" && coordinates.latitude >= 55) {\n nightFraction = night / 7;\n ishaTime = dateByAddingSeconds(sunsetTime, nightFraction);\n }\n\n var safeIsha = (function () {\n if (calculationParameters.method == \"MoonsightingCommittee\") {\n return Astronomical.seasonAdjustedEveningTwilight(coordinates.latitude, dayOfYear(date), date.getFullYear(), sunsetTime);\n }\n else {\n var portion = calculationParameters.nightPortions().isha;\n nightFraction = portion * night;\n return dateByAddingSeconds(sunsetTime, nightFraction);\n }\n })();\n\n if (ishaTime == null || isNaN(ishaTime.getTime()) || safeIsha < ishaTime) {\n ishaTime = safeIsha;\n }\n }\n\n maghribTime = sunsetTime;\n if (calculationParameters.maghribAngle) {\n let angleBasedMaghrib = new TimeComponents(solarTime.hourAngle(-1 * calculationParameters.maghribAngle, true)).utcDate(date.getFullYear(), date.getMonth(), date.getDate());\n if (sunsetTime < angleBasedMaghrib && ishaTime > angleBasedMaghrib) {\n maghribTime = angleBasedMaghrib;\n }\n }\n\n var fajrAdjustment = (calculationParameters.adjustments.fajr || 0) + (calculationParameters.methodAdjustments.fajr || 0);\n var sunriseAdjustment = (calculationParameters.adjustments.sunrise || 0) + (calculationParameters.methodAdjustments.sunrise || 0);\n var dhuhrAdjustment = (calculationParameters.adjustments.dhuhr || 0) + (calculationParameters.methodAdjustments.dhuhr || 0);\n var asrAdjustment = (calculationParameters.adjustments.asr || 0) + (calculationParameters.methodAdjustments.asr || 0);\n var maghribAdjustment = (calculationParameters.adjustments.maghrib || 0) + (calculationParameters.methodAdjustments.maghrib || 0);\n var ishaAdjustment = (calculationParameters.adjustments.isha || 0) + (calculationParameters.methodAdjustments.isha || 0);\n\n this.fajr = roundedMinute(dateByAddingMinutes(fajrTime, fajrAdjustment));\n this.sunrise = roundedMinute(dateByAddingMinutes(sunriseTime, sunriseAdjustment));\n this.dhuhr = roundedMinute(dateByAddingMinutes(dhuhrTime, dhuhrAdjustment));\n this.asr = roundedMinute(dateByAddingMinutes(asrTime, asrAdjustment));\n this.maghrib = roundedMinute(dateByAddingMinutes(maghribTime, maghribAdjustment));\n this.isha = roundedMinute(dateByAddingMinutes(ishaTime, ishaAdjustment));\n }\n\n timeForPrayer(prayer) {\n if (prayer == Prayer.Fajr) {\n return this.fajr;\n }\n else if (prayer == Prayer.Sunrise) {\n return this.sunrise;\n }\n else if (prayer == Prayer.Dhuhr) {\n return this.dhuhr;\n }\n else if (prayer == Prayer.Asr) {\n return this.asr;\n }\n else if (prayer == Prayer.Maghrib) {\n return this.maghrib;\n }\n else if (prayer == Prayer.Isha) {\n return this.isha;\n }\n else {\n return null;\n }\n }\n\n currentPrayer(date) {\n if (typeof date === 'undefined') {\n date = new Date();\n }\n if (date >= this.isha) {\n return Prayer.Isha;\n }\n else if (date >= this.maghrib) {\n return Prayer.Maghrib;\n }\n else if (date >= this.asr) {\n return Prayer.Asr;\n }\n else if (date >= this.dhuhr) {\n return Prayer.Dhuhr;\n }\n else if (date >= this.sunrise) {\n return Prayer.Sunrise;\n }\n else if (date >= this.fajr) {\n return Prayer.Fajr;\n }\n else {\n return Prayer.None;\n }\n }\n\n nextPrayer(date) {\n if (typeof date === 'undefined') {\n date = new Date();\n }\n if (date >= this.isha) {\n return Prayer.None;\n }\n else if (date >= this.maghrib) {\n return Prayer.Isha;\n }\n else if (date >= this.asr) {\n return Prayer.Maghrib;\n }\n else if (date >= this.dhuhr) {\n return Prayer.Asr;\n }\n else if (date >= this.sunrise) {\n return Prayer.Dhuhr;\n }\n else if (date >= this.fajr) {\n return Prayer.Sunrise;\n }\n else {\n return Prayer.Fajr;\n }\n }\n}\n\n","const HighLatitudeRule = {\n MiddleOfTheNight: 'middleofthenight',\n SeventhOfTheNight: 'seventhofthenight',\n TwilightAngle: 'twilightangle'\n};\n\nexport default HighLatitudeRule;","import { Madhab } from './Madhab';\nimport HighLatitudeRule from './HighLatitudeRule';\n\nexport default class CalculationParameters {\n constructor(methodName, fajrAngle, ishaAngle, ishaInterval, maghribAngle) {\n this.method = methodName || \"Other\";\n this.fajrAngle = fajrAngle || 0;\n this.ishaAngle = ishaAngle || 0;\n this.ishaInterval = ishaInterval || 0;\n this.maghribAngle = maghribAngle;\n this.madhab = Madhab.Shafi;\n this.highLatitudeRule = HighLatitudeRule.MiddleOfTheNight;\n this.adjustments = { fajr: 0, sunrise: 0, dhuhr: 0, asr: 0, maghrib: 0, isha: 0 };\n this.methodAdjustments = { fajr: 0, sunrise: 0, dhuhr: 0, asr: 0, maghrib: 0, isha: 0 };\n }\n\n nightPortions() {\n switch (this.highLatitudeRule) {\n case HighLatitudeRule.MiddleOfTheNight:\n return { fajr: 1 / 2, isha: 1 / 2 };\n case HighLatitudeRule.SeventhOfTheNight:\n return { fajr: 1 / 7, isha: 1 / 7 };\n case HighLatitudeRule.TwilightAngle:\n return { fajr: this.fajrAngle / 60, isha: this.ishaAngle / 60 };\n default:\n throw(`Invalid high latitude rule found when attempting to compute night portions: ${this.highLatitudeRule}`);\n }\n }\n}\n","import CalculationParameters from './CalculationParameters';\n\nconst CalculationMethod = {\n // Muslim World League\n MuslimWorldLeague: function() {\n let params = new CalculationParameters(\"MuslimWorldLeague\", 18, 17);\n params.methodAdjustments = { dhuhr: 1 };\n return params;\n },\n\n // Egyptian General Authority of Survey\n Egyptian: function() {\n let params = new CalculationParameters(\"Egyptian\", 19.5, 17.5);\n params.methodAdjustments = { dhuhr: 1 };\n return params;\n },\n\n // University of Islamic Sciences, Karachi\n Karachi: function() {\n let params = new CalculationParameters(\"Karachi\", 18, 18);\n params.methodAdjustments = { dhuhr: 1 };\n return params;\n },\n\n // Umm al-Qura University, Makkah\n UmmAlQura: function() {\n return new CalculationParameters(\"UmmAlQura\", 18.5, 0, 90);\n },\n\n // Dubai\n Dubai: function() {\n let params = new CalculationParameters(\"Dubai\", 18.2, 18.2);\n params.methodAdjustments = { sunrise: -3, dhuhr: 3, asr: 3, maghrib: 3 };\n return params;\n },\n\n // Moonsighting Committee\n MoonsightingCommittee: function() {\n let params = new CalculationParameters(\"MoonsightingCommittee\", 18, 18);\n params.methodAdjustments = { dhuhr: 5, maghrib: 3 };\n return params;\n },\n\n // ISNA\n NorthAmerica: function() {\n let params = new CalculationParameters(\"NorthAmerica\", 15, 15);\n params.methodAdjustments = { dhuhr: 1 };\n return params;\n },\n\n // Kuwait\n Kuwait: function() {\n return new CalculationParameters(\"Kuwait\", 18, 17.5);\n },\n\n // Qatar\n Qatar: function() {\n return new CalculationParameters(\"Qatar\", 18, 0, 90);\n },\n\n // Singapore\n Singapore: function() {\n let params = new CalculationParameters(\"Singapore\", 20, 18);\n params.methodAdjustments = { dhuhr: 1 };\n return params;\n },\n\n // Institute of Geophysics, University of Tehran\n Tehran: function() {\n let params = new CalculationParameters(\"Tehran\", 17.7, 14, 0, 4.5);\n return params;\n },\n\n // Dianet\n Turkey: function() {\n let params = new CalculationParameters(\"Turkey\", 18, 17);\n params.methodAdjustments = { sunrise: -7, dhuhr: 5, asr: 4, maghrib: 7 };\n return params;\n },\n\n // Other\n Other: function() {\n return new CalculationParameters(\"Other\", 0, 0);\n }\n};\n\nexport default CalculationMethod;","import Coordinates from './Coordinates'\nimport { degreesToRadians, radiansToDegrees, unwindAngle } from './MathUtils'\n\nexport default function qibla(coordinates) {\n const makkah = new Coordinates(21.4225241, 39.8261818);\n\n // Equation from \"Spherical Trigonometry For the use of colleges and schools\" page 50\n const term1 = (\n Math.sin(degreesToRadians(makkah.longitude) -\n degreesToRadians(coordinates.longitude))\n );\n const term2 = (\n Math.cos(degreesToRadians(coordinates.latitude)) *\n Math.tan(degreesToRadians(makkah.latitude))\n );\n const term3 = (\n Math.sin(degreesToRadians(coordinates.latitude)) *\n Math.cos(degreesToRadians(makkah.longitude) -\n degreesToRadians(coordinates.longitude))\n );\n const angle = Math.atan2(term1, term2 - term3);\n\n return unwindAngle(radiansToDegrees(angle));\n}\n","import { dateByAddingDays, dateByAddingSeconds, roundedMinute } from './DateUtils';\nimport PrayerTimes from './PrayerTimes';\n\nexport default class SunnahTimes {\n constructor(prayerTimes) {\n const date = prayerTimes.date;\n const nextDay = dateByAddingDays(date, 1);\n const nextDayPrayerTimes = new PrayerTimes(prayerTimes.coordinates, nextDay, prayerTimes.calculationParameters);\n\n const nightDuration = (nextDayPrayerTimes.fajr.getTime() - prayerTimes.maghrib.getTime()) / 1000.0;\n\n this.middleOfTheNight = roundedMinute(dateByAddingSeconds(prayerTimes.maghrib, nightDuration / 2));\n this.lastThirdOfTheNight = roundedMinute(dateByAddingSeconds(prayerTimes.maghrib, nightDuration * (2 / 3)));\n }\n}\n\n","import Coordinates from './Coordinates';\nimport PrayerTimes from './PrayerTimes';\nimport Prayer from './Prayer';\nimport { Madhab } from './Madhab';\nimport HighLatitudeRule from './HighLatitudeRule';\nimport CalculationMethod from './CalculationMethod';\nimport CalculationParameters from './CalculationParameters';\nimport qibla from './Qibla';\nimport SunnahTimes from './SunnahTimes';\n\nconst adhan = {\n Prayer: Prayer,\n Madhab: Madhab,\n HighLatitudeRule: HighLatitudeRule,\n Coordinates: Coordinates,\n CalculationParameters: CalculationParameters,\n CalculationMethod: CalculationMethod,\n PrayerTimes: PrayerTimes,\n SunnahTimes: SunnahTimes,\n Qibla: qibla\n};\n\nexport default adhan;"],"sourceRoot":""} \ No newline at end of file diff --git a/README.md b/README.md index 43c0d60..0a672f9 100644 --- a/README.md +++ b/README.md @@ -60,8 +60,9 @@ var coordinates = new adhan.Coordinates(35.78056, -78.6389); The date parameter passed in should be an instance of the JavaScript `Date` object. The year, month, and day values need to be populated. All other -values will be ignored. The year, month and day values should be for the local date -that you want prayer times for. These date values are expected to be for the Gregorian calendar. +values will be ignored. The year, month and day values should be for the date +that you want prayer times for. These date values are expected to be for the +Gregorian calendar. ```js var date = new Date(); @@ -95,17 +96,19 @@ params.adjustments.fajr = 2; | Value | Description | | ----- | ----------- | -| adhan.CalculationMethod.MuslimWorldLeague() | Muslim World League. Fajr angle: 18, Isha angle: 17 | -| adhan.CalculationMethod.Egyptian() | Egyptian General Authority of Survey. Fajr angle: 19.5, Isha angle: 17.5 | -| adhan.CalculationMethod.Karachi() | University of Islamic Sciences, Karachi. Fajr angle: 18, Isha angle: 18 | -| adhan.CalculationMethod.UmmAlQura() | Umm al-Qura University, Makkah. Fajr angle: 18, Isha interval: 90. *Note: you should add a +30 minute custom adjustment for Isha during Ramadan.* | -| adhan.CalculationMethod.Dubai() | Method used in UAE. Fajr angle: 18.2, Isha angle: 18.2. | -| adhan.CalculationMethod.Qatar() | Modified version of Umm al-Qura used in Qatar. Fajr angle: 18, Isha interval: 90. | -| adhan.CalculationMethod.Kuwait() | Method used by the country of Kuwait. Fajr angle: 18, Isha angle: 17.5 | -| adhan.CalculationMethod.MoonsightingCommittee() | Moonsighting Committee. Fajr angle: 18, Isha angle: 18. Also uses seasonal adjustment values. | -| adhan.CalculationMethod.Singapore() | Method used by Singapore. Fajr angle: 20, Isha angle: 18. | -| adhan.CalculationMethod.NorthAmerica() | Referred to as the ISNA method. This method is included for completeness but is not recommended. Fajr angle: 15, Isha angle: 15 | -| adhan.CalculationMethod.Other() | Fajr angle: 0, Isha angle: 0. This is the default value for `method` when initializing a `CalculationParameters` object. | +| adhan.CalculationMethod.MuslimWorldLeague() | Muslim World League. Standard Fajr time with an angle of 18°. Earlier Isha time with an angle of 17°. | +| adhan.CalculationMethod.Egyptian() | Egyptian General Authority of Survey. Early Fajr time using an angle 19.5° and a slightly earlier Isha time using an angle of 17.5°. | +| adhan.CalculationMethod.Karachi() | University of Islamic Sciences, Karachi. A generally applicable method that uses standard Fajr and Isha angles of 18°. | +| adhan.CalculationMethod.UmmAlQura() | Umm al-Qura University, Makkah. Uses a fixed interval of 90 minutes from maghrib to calculate Isha. And a slightly earlier Fajr time with an angle of 18.5°. *Note: you should add a +30 minute custom adjustment for Isha during Ramadan.* | +| adhan.CalculationMethod.Dubai() | Used in the UAE. Slightly earlier Fajr time and slightly later Isha time with angles of 18.2° for Fajr and Isha in addition to 3 minute offsets for sunrise, Dhuhr, Asr, and Maghrib. | +| adhan.CalculationMethod.Qatar() | Same Isha interval as `ummAlQura` but with the standard Fajr time using an angle of 18°. | +| adhan.CalculationMethod.Kuwait() | Standard Fajr time with an angle of 18°. Slightly earlier Isha time with an angle of 17.5°. | +| adhan.CalculationMethod.MoonsightingCommittee() | Method developed by Khalid Shaukat, founder of Moonsighting Committee Worldwide. Uses standard 18° angles for Fajr and Isha in addition to seasonal adjustment values. This method automatically applies the 1/7 approximation rule for locations above 55° latitude. Recommended for North America and the UK. | +| adhan.CalculationMethod.Singapore() | Used in Singapore, Malaysia, and Indonesia. Early Fajr time with an angle of 20° and standard Isha time with an angle of 18°. | +| adhan.CalculationMethod.Turkey() | An approximation of the Diyanet method used in Turkey. This approximation is less accurate outside the region of Turkey. | +| adhan.CalculationMethod.Tehran() | Institute of Geophysics, University of Tehran. Early Isha time with an angle of 14°. Slightly later Fajr time with an angle of 17.7°. Calculates Maghrib based on the sun reaching an angle of 4.5° below the horizon. | +| adhan.CalculationMethod.NorthAmerica() | Also known as the ISNA method. Can be used for North America, but the moonsightingCommittee method is preferable. Gives later Fajr times and early Isha times with angles of 15°. | +| adhan.CalculationMethod.Other() | Defaults to angles of 0°, should generally be used for making a custom method and setting your own values. | #### Madhab diff --git a/package.json b/package.json index e713f3e..f6fa76d 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ }, "homepage": "https://github.com/batoulapps/adhan-js", "keywords": ["adhan", "islam", "muslim", "prayer", "islamic", "prayer times", "salah", "salat", "salaat", "namaz"], - "author": "Ameir Al-Zoubi (https://ameir.com)", + "author": "Ameir Al-Zoubi ", "license": "MIT", "devDependencies": { "@babel/core": "^7.9.0", diff --git a/src/CalculationMethod.js b/src/CalculationMethod.js index ba3c25c..f9978bc 100644 --- a/src/CalculationMethod.js +++ b/src/CalculationMethod.js @@ -3,71 +3,84 @@ import CalculationParameters from './CalculationParameters'; const CalculationMethod = { // Muslim World League MuslimWorldLeague: function() { - let params = new CalculationParameters(18, 17, 0, "MuslimWorldLeague"); + let params = new CalculationParameters("MuslimWorldLeague", 18, 17); params.methodAdjustments = { dhuhr: 1 }; return params; }, // Egyptian General Authority of Survey Egyptian: function() { - let params = new CalculationParameters(19.5, 17.5, 0, "Egyptian"); + let params = new CalculationParameters("Egyptian", 19.5, 17.5); params.methodAdjustments = { dhuhr: 1 }; return params; }, // University of Islamic Sciences, Karachi Karachi: function() { - let params = new CalculationParameters(18, 18, 0, "Karachi"); + let params = new CalculationParameters("Karachi", 18, 18); params.methodAdjustments = { dhuhr: 1 }; return params; }, // Umm al-Qura University, Makkah UmmAlQura: function() { - return new CalculationParameters(18.5, 0, 90, "UmmAlQura"); + return new CalculationParameters("UmmAlQura", 18.5, 0, 90); }, // Dubai Dubai: function() { - let params = new CalculationParameters(18.2, 18.2, 0, "Dubai"); + let params = new CalculationParameters("Dubai", 18.2, 18.2); params.methodAdjustments = { sunrise: -3, dhuhr: 3, asr: 3, maghrib: 3 }; return params; }, // Moonsighting Committee MoonsightingCommittee: function() { - let params = new CalculationParameters(18, 18, 0, "MoonsightingCommittee"); + let params = new CalculationParameters("MoonsightingCommittee", 18, 18); params.methodAdjustments = { dhuhr: 5, maghrib: 3 }; return params; }, // ISNA NorthAmerica: function() { - let params = new CalculationParameters(15, 15, 0, "NorthAmerica"); + let params = new CalculationParameters("NorthAmerica", 15, 15); params.methodAdjustments = { dhuhr: 1 }; return params; }, // Kuwait Kuwait: function() { - return new CalculationParameters(18, 17.5, 0, "Kuwait"); + return new CalculationParameters("Kuwait", 18, 17.5); }, // Qatar Qatar: function() { - return new CalculationParameters(18, 0, 90, "Qatar"); + return new CalculationParameters("Qatar", 18, 0, 90); }, // Singapore Singapore: function() { - let params = new CalculationParameters(20, 18, 0, "Singapore"); + let params = new CalculationParameters("Singapore", 20, 18); params.methodAdjustments = { dhuhr: 1 }; return params; }, + // Institute of Geophysics, University of Tehran + Tehran: function() { + let params = new CalculationParameters("Tehran", 17.7, 14, 0, 4.5); + return params; + }, + + // Dianet + Turkey: function() { + let params = new CalculationParameters("Turkey", 18, 17); + params.methodAdjustments = { sunrise: -7, dhuhr: 5, asr: 4, maghrib: 7 }; + return params; + }, + // Other Other: function() { - return new CalculationParameters(0, 0, 0, "Other"); + return new CalculationParameters("Other", 0, 0); } }; diff --git a/src/CalculationParameters.js b/src/CalculationParameters.js index 7c170af..7e6da30 100644 --- a/src/CalculationParameters.js +++ b/src/CalculationParameters.js @@ -2,11 +2,12 @@ import { Madhab } from './Madhab'; import HighLatitudeRule from './HighLatitudeRule'; export default class CalculationParameters { - constructor(fajrAngle, ishaAngle, ishaInterval, methodName) { + constructor(methodName, fajrAngle, ishaAngle, ishaInterval, maghribAngle) { this.method = methodName || "Other"; this.fajrAngle = fajrAngle || 0; this.ishaAngle = ishaAngle || 0; this.ishaInterval = ishaInterval || 0; + this.maghribAngle = maghribAngle; this.madhab = Madhab.Shafi; this.highLatitudeRule = HighLatitudeRule.MiddleOfTheNight; this.adjustments = { fajr: 0, sunrise: 0, dhuhr: 0, asr: 0, maghrib: 0, isha: 0 }; diff --git a/src/PrayerTimes.js b/src/PrayerTimes.js index 95166af..d718a98 100644 --- a/src/PrayerTimes.js +++ b/src/PrayerTimes.js @@ -24,14 +24,14 @@ export default class PrayerTimes { dhuhrTime = new TimeComponents(solarTime.transit).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); sunriseTime = new TimeComponents(solarTime.sunrise).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); - maghribTime = new TimeComponents(solarTime.sunset).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); + var sunsetTime = new TimeComponents(solarTime.sunset).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); asrTime = new TimeComponents(solarTime.afternoon(shadowLength(calculationParameters.madhab))).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); var tomorrow = dateByAddingDays(date, 1); var tomorrowSolarTime = new SolarTime(tomorrow, coordinates); var tomorrowSunrise = new TimeComponents(tomorrowSolarTime.sunrise).utcDate(tomorrow.getFullYear(), tomorrow.getMonth(), tomorrow.getDate()); - var night = (tomorrowSunrise - maghribTime) / 1000; + var night = (tomorrowSunrise - sunsetTime) / 1000; fajrTime = new TimeComponents(solarTime.hourAngle(-1 * calculationParameters.fajrAngle, false)).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); @@ -57,24 +57,24 @@ export default class PrayerTimes { } if (calculationParameters.ishaInterval > 0) { - ishaTime = dateByAddingMinutes(maghribTime, calculationParameters.ishaInterval); + ishaTime = dateByAddingMinutes(sunsetTime, calculationParameters.ishaInterval); } else { ishaTime = new TimeComponents(solarTime.hourAngle(-1 * calculationParameters.ishaAngle, true)).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); // special case for moonsighting committee above latitude 55 if (calculationParameters.method == "MoonsightingCommittee" && coordinates.latitude >= 55) { nightFraction = night / 7; - ishaTime = dateByAddingSeconds(maghribTime, nightFraction); + ishaTime = dateByAddingSeconds(sunsetTime, nightFraction); } var safeIsha = (function () { if (calculationParameters.method == "MoonsightingCommittee") { - return Astronomical.seasonAdjustedEveningTwilight(coordinates.latitude, dayOfYear(date), date.getFullYear(), maghribTime); + return Astronomical.seasonAdjustedEveningTwilight(coordinates.latitude, dayOfYear(date), date.getFullYear(), sunsetTime); } else { var portion = calculationParameters.nightPortions().isha; nightFraction = portion * night; - return dateByAddingSeconds(maghribTime, nightFraction); + return dateByAddingSeconds(sunsetTime, nightFraction); } })(); @@ -83,6 +83,14 @@ export default class PrayerTimes { } } + maghribTime = sunsetTime; + if (calculationParameters.maghribAngle) { + let angleBasedMaghrib = new TimeComponents(solarTime.hourAngle(-1 * calculationParameters.maghribAngle, true)).utcDate(date.getFullYear(), date.getMonth(), date.getDate()); + if (sunsetTime < angleBasedMaghrib && ishaTime > angleBasedMaghrib) { + maghribTime = angleBasedMaghrib; + } + } + var fajrAdjustment = (calculationParameters.adjustments.fajr || 0) + (calculationParameters.methodAdjustments.fajr || 0); var sunriseAdjustment = (calculationParameters.adjustments.sunrise || 0) + (calculationParameters.methodAdjustments.sunrise || 0); var dhuhrAdjustment = (calculationParameters.adjustments.dhuhr || 0) + (calculationParameters.methodAdjustments.dhuhr || 0); diff --git a/test/adhan.test.js b/test/adhan.test.js index e7e7534..e8cd1ea 100644 --- a/test/adhan.test.js +++ b/test/adhan.test.js @@ -4,22 +4,22 @@ import { dateByAddingSeconds } from '../src/DateUtils'; import { shadowLength } from '../src/Madhab'; test("Verifying the night portion defined by the high latitude rule", () => { - let p1 = new adhan.CalculationParameters(18, 18); + let p1 = new adhan.CalculationParameters("Other", 18, 18); p1.highLatitudeRule = adhan.HighLatitudeRule.MiddleOfTheNight; expect(p1.nightPortions().fajr).toBe(0.5); expect(p1.nightPortions().isha).toBe(0.5); - let p2 = new adhan.CalculationParameters(18, 18); + let p2 = new adhan.CalculationParameters("Other", 18, 18); p2.highLatitudeRule = adhan.HighLatitudeRule.SeventhOfTheNight; expect(p2.nightPortions().fajr).toBe(1/7); expect(p2.nightPortions().isha).toBe(1/7); - let p3 = new adhan.CalculationParameters(10, 15); + let p3 = new adhan.CalculationParameters("Other", 10, 15); p3.highLatitudeRule = adhan.HighLatitudeRule.TwilightAngle; expect(p3.nightPortions().fajr).toBe(10/60); expect(p3.nightPortions().isha).toBe(15/60); - let p4 = new adhan.CalculationParameters(10, 15); + let p4 = new adhan.CalculationParameters("Other", 10, 15); p4.highLatitudeRule = adhan.HighLatitudeRule.fake; expect(() => { p4.nightPortions().fajr }).toThrow(); expect(() => { p4.nightPortions().isha }).toThrow(); @@ -85,6 +85,24 @@ test("Verifying the angles defined by the calculation method", () => { expect(p10.ishaAngle).toBe(0); expect(p10.ishaInterval).toBe(90); expect(p10.method).toBe("Qatar"); + + let p11 = adhan.CalculationMethod.Singapore(); + expect(p11.fajrAngle).toBe(20); + expect(p11.ishaAngle).toBe(18); + expect(p11.ishaInterval).toBe(0); + expect(p11.method).toBe("Singapore"); + + let p12 = adhan.CalculationMethod.Tehran(); + expect(p12.fajrAngle).toBe(17.7); + expect(p12.ishaAngle).toBe(14); + expect(p12.ishaInterval).toBe(0); + expect(p12.method).toBe("Tehran"); + + let p13 = adhan.CalculationMethod.Turkey(); + expect(p13.fajrAngle).toBe(18); + expect(p13.ishaAngle).toBe(17); + expect(p13.ishaInterval).toBe(0); + expect(p13.method).toBe("Turkey"); }); test("calculating prayer times", () => { @@ -154,7 +172,32 @@ test("calculating Moonsighting Committee prayer times at a high latitude locatio expect(moment(p.asr).tz("Europe/Oslo").format("h:mm A")).toBe("1:36 PM"); expect(moment(p.maghrib).tz("Europe/Oslo").format("h:mm A")).toBe("3:25 PM"); expect(moment(p.isha).tz("Europe/Oslo").format("h:mm A")).toBe("5:02 PM"); -}); +}); + +test("calculating times for turkey method", () => { + // values from https://namazvakitleri.diyanet.gov.tr/en-US/9541/prayer-time-for-istanbul + let date = new Date(2020, 3, 16); + let params = adhan.CalculationMethod.Turkey(); + let p = new adhan.PrayerTimes(new adhan.Coordinates(41.005616, 28.976380), date, params); + expect(moment(p.fajr).tz("Europe/Istanbul").format("h:mm A")).toBe("4:44 AM"); + expect(moment(p.sunrise).tz("Europe/Istanbul").format("h:mm A")).toBe("6:16 AM"); + expect(moment(p.dhuhr).tz("Europe/Istanbul").format("h:mm A")).toBe("1:09 PM"); + expect(moment(p.asr).tz("Europe/Istanbul").format("h:mm A")).toBe("4:53 PM"); // original time 4:52 PM + expect(moment(p.maghrib).tz("Europe/Istanbul").format("h:mm A")).toBe("7:52 PM"); + expect(moment(p.isha).tz("Europe/Istanbul").format("h:mm A")).toBe("9:19 PM"); // original time 9:18 PM +}); + +test("calculating times for the egyptian method", () => { + let date = new Date(2020, 0, 1); + let params = adhan.CalculationMethod.Egyptian(); + let p = new adhan.PrayerTimes(new adhan.Coordinates(30.028703, 31.249528), date, params); + expect(moment(p.fajr).tz("Africa/Cairo").format("h:mm A")).toBe("5:18 AM"); + expect(moment(p.sunrise).tz("Africa/Cairo").format("h:mm A")).toBe("6:51 AM"); + expect(moment(p.dhuhr).tz("Africa/Cairo").format("h:mm A")).toBe("11:59 AM"); + expect(moment(p.asr).tz("Africa/Cairo").format("h:mm A")).toBe("2:47 PM"); + expect(moment(p.maghrib).tz("Africa/Cairo").format("h:mm A")).toBe("5:06 PM"); + expect(moment(p.isha).tz("Africa/Cairo").format("h:mm A")).toBe("6:29 PM"); +}); test("getting the time for a given prayer", () => { let date = new Date(2016, 6, 1); @@ -231,4 +274,37 @@ test("getting the madhab shadow length", () => { expect(shadowLength(adhan.Madhab.Shafi)).toBe(1); expect(shadowLength(adhan.Madhab.Hanafi)).toBe(2); expect(() => { shadowLength(adhan.Madhab.Foo) }).toThrow(); +}); + +test("adjusting prayer time with high latitude rule", () => { + let date = new Date(2020, 5, 15); + let params = adhan.CalculationMethod.MuslimWorldLeague(); + let tzid = "Europe/London"; + let coords = new adhan.Coordinates(55.983226, -3.216649); + + let p1 = new adhan.PrayerTimes(coords, date, params); + expect(moment(p1.fajr).tz(tzid).format("h:mm A")).toBe("1:14 AM"); + expect(moment(p1.sunrise).tz(tzid).format("h:mm A")).toBe("4:26 AM"); + expect(moment(p1.dhuhr).tz(tzid).format("h:mm A")).toBe("1:14 PM"); + expect(moment(p1.asr).tz(tzid).format("h:mm A")).toBe("5:46 PM"); + expect(moment(p1.maghrib).tz(tzid).format("h:mm A")).toBe("10:01 PM"); + expect(moment(p1.isha).tz(tzid).format("h:mm A")).toBe("1:14 AM"); + + params.highLatitudeRule = adhan.HighLatitudeRule.SeventhOfTheNight; + let p2 = new adhan.PrayerTimes(coords, date, params); + expect(moment(p2.fajr).tz(tzid).format("h:mm A")).toBe("3:31 AM"); + expect(moment(p2.sunrise).tz(tzid).format("h:mm A")).toBe("4:26 AM"); + expect(moment(p2.dhuhr).tz(tzid).format("h:mm A")).toBe("1:14 PM"); + expect(moment(p2.asr).tz(tzid).format("h:mm A")).toBe("5:46 PM"); + expect(moment(p2.maghrib).tz(tzid).format("h:mm A")).toBe("10:01 PM"); + expect(moment(p2.isha).tz(tzid).format("h:mm A")).toBe("10:56 PM"); + + params.highLatitudeRule = adhan.HighLatitudeRule.TwilightAngle; + let p3 = new adhan.PrayerTimes(coords, date, params); + expect(moment(p3.fajr).tz(tzid).format("h:mm A")).toBe("2:31 AM"); + expect(moment(p3.sunrise).tz(tzid).format("h:mm A")).toBe("4:26 AM"); + expect(moment(p3.dhuhr).tz(tzid).format("h:mm A")).toBe("1:14 PM"); + expect(moment(p3.asr).tz(tzid).format("h:mm A")).toBe("5:46 PM"); + expect(moment(p3.maghrib).tz(tzid).format("h:mm A")).toBe("10:01 PM"); + expect(moment(p3.isha).tz(tzid).format("h:mm A")).toBe("11:50 PM"); }); \ No newline at end of file diff --git a/test/times.test.js b/test/times.test.js index 1ab34ac..73bd946 100644 --- a/test/times.test.js +++ b/test/times.test.js @@ -26,6 +26,10 @@ function parseParams(data) { params = adhan.CalculationMethod.Qatar(); } else if (method == "Singapore") { params = adhan.CalculationMethod.Singapore(); + } else if (method == "Turkey") { + params = adhan.CalculationMethod.Turkey(); + } else if (method == "Tehran") { + params = adhan.CalculationMethod.Tehran(); } else { params = adhan.CalculationMethod.Other(); }