Coder Social home page Coder Social logo

sweden-prayer-times's Introduction

Sweden Prayer Times

Build Status Test Covarage 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.

sweden-prayer-times's People

Contributors

greenkeeper[bot] avatar risan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

yusufsense

sweden-prayer-times's Issues

Blocked Request

When trying to make a request a "406 Security Incident" was detected, stating the firewall detected a suspicious request.
Error:

/home/user/node_modules/send-request/src/index.js:46
          const error = new Error(transformed.statusMessage);
                        ^

Error: Not Acceptable
    at IncomingMessage.<anonymous> (/home/user/node_modules/send-request/src/index.js:46:25)
    at IncomingMessage.emit (node:events:532:35)
    at endReadableNT (node:internal/streams/readable:1346:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  response: {
    statusCode: 406,
    statusMessage: 'Not Acceptable',
    headers: {
      date: 'Sat, 12 Nov 2022 10:18:01 GMT',
      server: 'Apache',
      'content-length': '568',
      connection: 'close',
      'content-type': 'text/html; charset=iso-8859-1'
    },
    body: "<html><head><title>406 Security Incident Detected</title><meta name='viewport' content='width=device-width'><link href='//splash.simply.com/errorpage.css' rel='stylesheet'></head><body><h1>406 Security Incident Detected</h1><p>Your request was blocked.</p><h3>If you are the owner of the website:</h3><p>The Website Application Firewall blocked this request for being suspicious.</p><p>You can see the detailed reason for this in your webserver logs.</p><hr><p> code - www.islamiskaforbundet.se - ip adress - code </p></body></html>"
  }
}

Screenshot 2022-11-12 at 11-24-17 406 Security Incident Detected

Code:

const swedenPrayerTimes = require("sweden-prayer-times");

(async () => {
  const prayerTimes = await swedenPrayerTimes("Stockholm");

  console.log(prayerTimes);
})();

An in-range update of date-fns is breaking the build 🚨

The dependency date-fns was updated from 1.29.0 to 1.30.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

date-fns is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.