Skip to content

Commit

Permalink
added Turkey and Tehran calculation methods
Browse files Browse the repository at this point in the history
  • Loading branch information
z3bi committed Apr 28, 2020
1 parent 0f5ce71 commit 248b75d
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 56 deletions.
63 changes: 45 additions & 18 deletions Adhan.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Adhan.js.map

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]> (https://ameir.com)",
"author": "Ameir Al-Zoubi <[email protected]>",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.9.0",
Expand Down
35 changes: 24 additions & 11 deletions src/CalculationMethod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/CalculationParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
Loading

0 comments on commit 248b75d

Please sign in to comment.