mv-prayertimes

Prayer times for Maldives

Usage no npm install needed!

<script type="module">
  import mvPrayertimes from 'https://cdn.skypack.dev/mv-prayertimes';
</script>

README

mv-prayertimes

Prayer times for Maldives

This package uses a JSON replicate of the database used in the salatmv app. The source .db file can be found in the github repo.

Install

npm install mv-prayertimes

or

yarn install mv-prayertimes

Usage

import { MVPrayerTimes } from "mv-prayertimes";
// const { MVPrayerTimes } = require("mv-prayertimes");

const PrayerTimes = new MVPrayerTimes(102); // island id
const PrayerTimes = new MVPrayerTimes("K. Male"); // atoll and island
const PrayerTimes = new MVPrayerTimes("K", "Male"); // atoll and island

// get island id using
PrayerTimes.island.islandId; // 102

// prayer times for today
PrayerTimes.today; // [{call: 'fajr', ...}, ...]

// next prayer time
PrayerTimes.nextPrayer; // {call: 'fajr', timeInMinutes: 301, string: '' ...}

// events for every prayer time

PrayerTimes.on("prayer", (details) => {
  console.log(
    `[${details.string /* 5:30 */}] It's ${details.call /* fajr */} time!`
  );

  console.log(
    `Next prayer: ${PrayerTimes.nextPrayer.call /* dhuhr */} at ${
      PrayerTimes.nextPrayer.string /* 12:11 */
    }`
  );
});