npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

prayertiming

v2.0.2

Published

A small library to calculate muslim prayer times based on coordinates and timezone

Downloads

90

Readme

prayertiming Stars · License · GitHub issues · Build & Test

A Muslim prayer times calculation 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

| Parameter | Type | Description | | ---------- | ---------------------- | ------------------------------------------------------------------- | | date | JavaScript date object | A valid JavaScript date object. [default new Date()] | | lat | Number | Latitude | | long | Number | Longitude | | timezone | Number | [default collects from system] | | dst | Number | Daylight savings time [default collects from system] | | elv | Number | Elevation [default 0] | | timeFormat | String | '24h' or '12h' format [default 24h] | | method | String | Calculation method [default MWL] | | config | Object | Custom 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

| Parameter | Type | Description | | ---------- | ------ | ---------------------------------------------------------------------- | | month | Number | JavaScript month number from 0 to 11 [default new Date().getMonth()] | | year | Number | Valid year value [default new Date().getFullYear()] | | lat | Number | Latitude | | long | Number | Longitude | | timezone | Number | [default collects from system] | | dst | Number | Daylight savings time [default collects from system] | | elv | Number | Elevation [default 0] | | timeFormat | String | '24h' or '12h' format [default 24h] | | method | String | Calculation method [default MWL] | | config | Object | Custom 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

| Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------------------------------------------------------ | | imsak | String | Time difference between fajr and suhoor [default 10 min] | | dhuhr | String | Time difference between midday and dhuhr [default 0 min] | | maghrib | String | Time difference between sunset and maghrib [default 0 min] | | midnight | String | Midnight calculation method (Standard or Jafari) [default Standard] | | highLats | String | Night portion calculation method (AngleBased, OneSeventh or NightMiddle) [default NightMiddle] |

Calculation Methods

| Name | Authority | Config | | ------- | --------------------------------------------- | -------------------------------------------------------- | | Egypt | Egyptian General Authority of Survey | fajr: 19.5, isha: 17.5 | | ISNA | Islamic Society of North America (ISNA) | fajr: 15, isha: 15 | | Jafari | Shia Ithna-Ashari, Leva Institute, Qum | fajr: 16, isha: 14, maghrib: 4, midnight: 'Jafari' | | JAKIM | Jabatan Kemajuan Islam Malaysia | fajr: 20, isha: 18 | | Karachi | University of Islamic Sciences, Karachi | fajr: 18, isha: 18 | | Makkah | Umm Al-Qura University, Makkah | fajr: 18.5, isha: '90 min' | | MF | Muslims of France (MF) | fajr: 12, isha: 12 | | MWL | Muslim World League | fajr: 18, isha: 17 | | Tehran | Institute of Geophysics, University of Tehran | fajr: 17.7, isha: 14, maghrib: 4.5, midnight: 'Jafari' |

  • For Makkah fajr was 19 degrees before 1430 hijri