How to use the adhan.CalculationMethod function in adhan

To help you get started, we’ve selected a few adhan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mr-islam / layl / src / App.js View on Github external
calcTimes() {
      let coordinates = new adhan.Coordinates(this.state.lat, this.state.lon)
      let today = new Date()
      let tomorrow = new Date()
      tomorrow.setDate(today.getDate()+1)
      var params = adhan.CalculationMethod.MoonsightingCommittee()
      let prayerTimesToday = new adhan.PrayerTimes(coordinates, today, params)
      let prayerTimesTomorrow = new adhan.PrayerTimes(coordinates, tomorrow, params)
      console.log(prayerTimesTomorrow)

      let maghrib = dayjs(prayerTimesToday.maghrib)
      let fajr = dayjs(prayerTimesTomorrow.fajr)
      console.log(maghrib)
      console.log(fajr)
      
      let interval = fajr.diff(maghrib, 'millisecond') / 6
      console.log(interval)
      let times = []
      for (let i = 0; i < 7; i++) {
        times.push(maghrib.add(interval * i, 'millisecond'))
      }
      console.log(times)
github quran / beautifulprayer / src / MethodSelect / index.js View on Github external
const MethodSelect = ({ value, onChange }) => (
  <select value="{value}">
    {
      Object.keys(adhan.CalculationMethod).map(method =&gt; (
        <option value="{method}">{method.replace(/([a-z\d])([A-Z])/g, `$1 $2`)}</option>
      ))
    }
  </select>
);

adhan

High precision Islamic prayer time library

MIT
Latest version published 2 years ago

Package Health Score

58 / 100
Full package analysis