1.0.0 • Published 3 years ago

prayertiming v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

prayertiming

A muslim prayer times calculation node library based on coordinates.

Installation

$ npm i prayertiming

Usage

const { getByDay, getByMonth } = require('prayertiming');

or

import { getByDay, getByMonth } from 'prayertiming';
const date = new Date('2021-04-24T05:16:54.442Z');

getByDay({
  date,
  long: 90.38,
  lat: 23.75,
  method: 'Karachi',
  timeFormat: '12h',
}); // returns and object

getByMonth({
  month: 3,
  year: 2021,
  long: 90.38,
  lat: 23.75,
  method: 'Karachi',
  timeFormat: '12h',
}); // returns an array of object

Methods

getByDay

This method takes latitude, longitude, date and some other configs and returns an object containing the prayer times.

inputs

ParameterTypeDescription
dateJavaScript date objectA valid JavaScript date object. default new Date()
latNumberLatitude
longNumberLongitude
timezoneNumberdefault collects from system
dstNumberDaylight savings time default collects from system
elvNumberElevation default 0
timeFormatString'24h' or '12h' format default 24h
methodStringCalculation method default MWL
configObjectCustom calculation configuration default {}

output

{
  date: '2021-04-24T05:16:54.442Z',
  method: 'Karachi',
  imsak: '4:01 am',
  fajr: '4:11 am',
  sunrise: '5:30 am',
  dhuhr: '11:57 am',
  asr: '3:23 pm',
  asrHanafi: '4:31 pm',
  sunset: '6:24 pm',
  maghrib: '6:24 pm',
  isha: '7:43 pm',
  midnight: '11:57 pm',
}

getByMonth

This method takes latitude, longitude, month, year and some other configs and returns an array of object containing the prayer times.

inputs

ParameterTypeDescription
monthNumberJavaScript month number from 0 to 11 default new Date().getMonth()
yearNumberValid year value default new Date().getFullYear()
latNumberLatitude
longNumberLongitude
timezoneNumberdefault collects from system
dstNumberDaylight savings time default collects from system
elvNumberElevation default 0
timeFormatString'24h' or '12h' format default 24h
methodStringCalculation method default MWL
configObjectCustom calculation configuration default {}

output

[
  {
    date: '2021-04-01T00:00:00.000Z',
    method: 'Karachi',
    imsak: '4:25 am',
    fajr: '4:35 am',
    sunrise: '5:51 am',
    dhuhr: '12:02 pm',
    asr: '3:30 pm',
    asrHanafi: '4:30 pm',
    sunset: '6:14 pm',
    maghrib: '6:14 pm',
    isha: '7:30 pm',
    midnight: '12:03 am',
  },
  {
    date: '2021-04-02T00:00:00.000Z',
    method: 'Karachi',
    imsak: '4:24 am',
    fajr: '4:34 am',
    sunrise: '5:50 am',
    dhuhr: '12:02 pm',
    asr: '3:29 pm',
    asrHanafi: '4:30 pm',
    sunset: '6:15 pm',
    maghrib: '6:15 pm',
    isha: '7:31 pm',
    midnight: '12:02 am',
  },
  ...
  ...
]

config

ParameterTypeDescription
imsakStringTime difference between fajr and suhoor default 10 min
dhuhrStringTime difference between midday and dhuhr default 0 min
maghribStringTime difference between sunset and maghrib default 0 min
midnightStringMidnight calculation method (Standard or Jafari) default Standard
highLatsStringNight portion calculation method (AngleBased, OneSeventh or NightMiddle) default NightMiddle

Calculation Methods

NameAuthorityConfig
EgyptEgyptian General Authority of Surveyfajr: 19.5, isha: 17.5
ISNAIslamic Society of North America (ISNA)fajr: 15, isha: 15
JafariShia Ithna-Ashari, Leva Institute, Qumfajr: 16, isha: 14, maghrib: 4, midnight: 'Jafari'
JAKIMJabatan Kemajuan Islam Malaysiafajr: 20, isha: 18
KarachiUniversity of Islamic Sciences, Karachifajr: 18, isha: 18
MakkahUmm Al-Qura University, Makkahfajr: 18.5, isha: '90 min'
MFMuslims of France (MF)fajr: 12, isha: 12
MWLMuslim World Leaguefajr: 18, isha: 17
TehranInstitute of Geophysics, University of Tehranfajr: 17.7, isha: 14, maghrib: 4.5, midnight: 'Jafari'
  • For Makkah fajr was 19 degrees before 1430 hijri