batoulapps / adhan-js

High precision Islamic prayer time library for JavaScript
MIT License
387 stars 87 forks source link

How to display prayer times of one month or later #9

Closed Asim187 closed 4 years ago

Asim187 commented 4 years ago

First of All, Thanks for Great Script may Allah give you best return for your work

If I want to display prayer times of one month can it be possible with this script? If yes then what will be the method.

z3bi commented 4 years ago

Yes that is certainly possible. It will be up to you to create a Date object for each day of the month, and then you can pass each of those date objects create a new PrayerTimes object.

something like this:

const monthDays = [Date(...), Date(...), etc];

monthDays(function(day){
   const times = new adhan.PrayerTimes(coordinates, day, params)
})
Asim187 commented 4 years ago

Is it possible to get prayer time in 24hours format

thanks

z3bi commented 4 years ago

@Asim187 yes, if you use moment.js you an do something like:

moment(prayerTimes.fajr).tz('America/New_York').format('HH:mm');