batoulapps / adhan-js

High precision Islamic prayer time library for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some Problem With Indonesia Coordinate

AthallahDzaki opened this issue · comments

Fajr Time : 5:37 AM
Sunrise Time : 5:34 AM

var coordinates = new adhan.Coordinates( -7.974219442081672, 112.62662994813381);
var fajrTime = moment(prayerTimes.fajr).tz('Asia/Jakarta').format('h:mm A');
var sunriseTime = moment(prayerTimes.sunrise).tz('Asia/Jakarta').format('h:mm A');

What calculation method are you using?

Please post all parameters you are using. Thanks.

Btw, how to make the time to be timestamp?

@AthallahDzaki you are getting incorrect times because you are using the other calculation method. That method is meant to be used when you then provide your own fajr angle and isha angle. Something like this

var date = new Date();
var coordinates = new adhan.Coordinates( -7.974219442081672, 112.62662994813381);
var params = adhan.CalculationMethod.Other();
params.fajrAngle = 18.0;
params.ishaAngle = 18.0;
params.madhab = adhan.Madhab.Hanafi;
var prayerTimes = new adhan.PrayerTimes(coordinates, date, params);

But in most cases instead of using other you should be selecting a preset calculation method like muslimWorldLeague or karachi. See https://github.com/batoulapps/adhan-js/blob/master/METHODS.md for more info.