sweden-prayer-times

2.0.4 • Public • Published

Sweden Prayer Times

Build Status Test Covarage Greenkeeper Latest Version

Get prayer times in Sweden based on the data from Islamiska Förbundet's website.

Installation

$ npm install sweden-prayer-times

Usage

Get prayer times in Stockholm:

const swedenPrayerTimes = require("sweden-prayer-times");
 
(async () => {
  const prayerTimes = await swedenPrayerTimes("Stockholm");
 
  console.log(prayerTimes);
})();

The example output:

{
  city: "Stockholm",
  date: "2018-01-30",
  schedule: {
    fajr: "05:35",
    sunrise: "07:57",
    dhuhr: "12:07",
    asr: "13:39",
    maghrib: "16:05"
    isha: "17:25"
  }
}

Recipes

Get Prayer Times for a Specified Date

const swedenPrayerTimes = require("sweden-prayer-times");
 
(async () => {
  const prayerTimes = await getPrayerTimes("Uppsala", "2018-08-17");
 
  console.log(prayerTimes);
})();

Handling Error

const swedenPrayerTimes = require("sweden-prayer-times");
 
(async () => {
  try {
    const prayerTimes = await getPrayerTimes("Foo");
    console.log(prayerTimes);
  } catch(error) {
    console.error(error.message);
  }
})();

API

swedenPrayerTimes(city, [date])

Parameters

  • city (String): The city name in Sweden.
  • date (optional Date|String|Number): The date to retrieve, default to today's date. It will be parsed by date-fns/parse.

Return

It returns a Promise which when resolved contains an object with the following structure:

{
  city: "Stockholm",
  date: "2018-01-30",
  schedule: {
    fajr: "05:35",
    sunrise: "07:57",
    dhuhr: "12:07",
    asr: "13:39",
    maghrib: "16:05"
    isha: "17:25"
  }
}

Related

License

MIT © Risan Bagja Pradana

Legal

This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by Islamiska Förbundet or any of its affiliates or subsidiaries. This is an independent and unofficial API.

Package Sidebar

Install

npm i sweden-prayer-times

Weekly Downloads

1

Version

2.0.4

License

MIT

Unpacked Size

6.89 kB

Total Files

6

Last publish

Collaborators

  • risan