Closed buildwithmalik closed 5 years ago
`var adhan = require('adhan')
const lat = 17.4055471 // Hyderabad latitude and longitude const long = 78.4128823
var date = new Date(); var coordinates = new adhan.Coordinates(lat, long); var params = adhan.CalculationMethod.Karachi(); params.madhab = adhan.Madhab.Hanafi;
var prayerTimes = new adhan.PrayerTimes(coordinates, date, params); var formattedTime = adhan.Date.formattedTime; console.log('Fajr: ' + formattedTime(prayerTimes.fajr, 5.3) + '\n'); console.log('Sunrise: ' + formattedTime(prayerTimes.sunrise, 5.3) + '\n'); console.log('Dhuhr: ' + formattedTime(prayerTimes.dhuhr, 5.3) + '\n'); console.log('Asr: ' + formattedTime(prayerTimes.asr, 5.3) + '\n'); console.log('Maghrib: ' + formattedTime(prayerTimes.maghrib, 5.3) + '\n'); console.log('Isha: ' + formattedTime(prayerTimes.isha, 5.3) + '\n');`
************ OUTPUT ********************
Fajr: 4:46 AM
Sunrise: 5:58 AM
Dhuhr: 11:50 AM
Asr: 4:03 PM
Maghrib: 5:40 PM
Isha: 6:53 PM
******************** CORRECT TIMINGS ********************
FAJR 04:58 AM
SUNRISE 06:10 AM
DHUHR 12:02 PM
ASR 03:22 PM
MAGHRIB 05:53 PM
ISHA 07:05 PM
am i doing something wrong?
@alexander-bourne the UTC offset for Hyderabad is 5.5 hours (5 hours and 30 minutes) not 5.3 hours.
`var adhan = require('adhan')
const lat = 17.4055471 // Hyderabad latitude and longitude const long = 78.4128823
var date = new Date(); var coordinates = new adhan.Coordinates(lat, long); var params = adhan.CalculationMethod.Karachi(); params.madhab = adhan.Madhab.Hanafi;
var prayerTimes = new adhan.PrayerTimes(coordinates, date, params); var formattedTime = adhan.Date.formattedTime; console.log('Fajr: ' + formattedTime(prayerTimes.fajr, 5.3) + '\n'); console.log('Sunrise: ' + formattedTime(prayerTimes.sunrise, 5.3) + '\n'); console.log('Dhuhr: ' + formattedTime(prayerTimes.dhuhr, 5.3) + '\n'); console.log('Asr: ' + formattedTime(prayerTimes.asr, 5.3) + '\n'); console.log('Maghrib: ' + formattedTime(prayerTimes.maghrib, 5.3) + '\n'); console.log('Isha: ' + formattedTime(prayerTimes.isha, 5.3) + '\n');`
Fajr: 4:46 AM
Sunrise: 5:58 AM
Dhuhr: 11:50 AM
Asr: 4:03 PM
Maghrib: 5:40 PM
Isha: 6:53 PM
FAJR 04:58 AM
SUNRISE 06:10 AM
DHUHR 12:02 PM
ASR 03:22 PM
MAGHRIB 05:53 PM
ISHA 07:05 PM