hablullah / go-prayer Goto Github PK
View Code? Open in Web Editor NEWGo package for getting salat times in a specific location
License: MIT License
Go package for getting salat times in a specific location
License: MIT License
Hey North America Isnt working for some reason
https://gyazo.com/a2856306682919b05dc00e8542aba7bb
when i print it i get these times
[{"fajir":"17:43","duhur":"17:43","asr":"06:38","magrib":"10:05","isha":"11:48"}]]
these times are way way off
Error log:
panic: Cannot create a Decimal from NaN
goroutine 25 [running]:
github.com/shopspring/decimal.newFromFloat(0x7ff8000000000001, 0x7ff8000000000001, 0xbd1bf0, 0xbff0626d4dcc0f2e, 0x7ff8000000000001)
/home/onodera/wrk/pkg/mod/github.com/shopspring/[email protected]/decimal.go:210 +0x443
github.com/shopspring/decimal.NewFromFloat(0x7ff8000000000001, 0x7ff8000000000001, 0xbff0626d4dcc0f2e)
/home/onodera/wrk/pkg/mod/github.com/shopspring/[email protected]/decimal.go:186 +0x92
github.com/RadhiFadlillah/go-prayer/internal/trigonometry.Acos(0xc0010fa980, 0xc0fffffff0, 0xc0010fa8c0, 0xffffffe0)
/home/onodera/wrk/pkg/mod/github.com/!radhi!fadlillah/[email protected]/internal/trigonometry/trigonometry.go:35 +0x57
github.com/RadhiFadlillah/go-prayer/internal/prayer.TimeCalculator.getHourAngle(0x4035000000000000, 0xc0010c01c0, 0xfffffffc, 0xc0010c01e0, 0xfffffffc, 0xc0010c0160, 0x0, 0xc0010c0180, 0x0, 0xc0010c01a0, ...)
/home/onodera/wrk/pkg/mod/github.com/!radhi!fadlillah/[email protected]/internal/prayer/calculator.go:137 +0x1da
github.com/RadhiFadlillah/go-prayer/internal/prayer.TimeCalculator.GetFajrTime(0x4035000000000000, 0xc0010c01c0, 0xfffffffc, 0xc0010c01e0, 0xfffffffc, 0xc0010c0160, 0x0, 0xc0010c0180, 0x0, 0xc0010c01a0, ...)
/home/onodera/wrk/pkg/mod/github.com/!radhi!fadlillah/[email protected]/internal/prayer/calculator.go:59 +0x86
github.com/RadhiFadlillah/go-prayer.GetTimes(0xbfaa3a7d46adac71, 0x1f358fb3, 0xc16440, 0x404a1058793dd97f, 0x4016aca57a786c22, 0x4035000000000000, 0x0, 0x0, 0x1, 0x0, ...)
/home/onodera/wrk/pkg/mod/github.com/!radhi!fadlillah/[email protected]/calculator.go:74 +0x2bb
main.(*Bar).initPopups.func1()
/home/onodera/wrk/src/github.com/onodera-punpun/melonbar/popups.go:40 +0x1fd
main.(*Bar).drawPopup(0xc000ce0460, 0x7cf0bf, 0x5, 0x4, 0x74c760)
/home/onodera/wrk/src/github.com/onodera-punpun/melonbar/popup.go:75 +0x334
main.(*Bar).initBlocks.func17(0xc0005f2322, 0xc000116910)
/home/onodera/wrk/src/github.com/onodera-punpun/melonbar/blocks.go:293 +0x3f
created by main.(*Bar).drawBlocks.func1
/home/onodera/wrk/src/github.com/onodera-punpun/melonbar/block.go:103 +0x23a
I have a feeling this is because something rounds to zero or something, which makes the decimal package return a panic.
Code that crashes (for me):
// Get the prayer times.
ptl, _ := prayer.GetTimes(time.Now(), prayer.Config{
Latitude: 52.1277,
Longitude: 5.6686,
Elevation: 21,
CalculationMethod: prayer.MWL,
AsrJuristicMethod: prayer.Hanafi,
PreciseToSeconds: false,
})
Slightly changing the Latitude to 51 for example fixes the crash, also the crash didn't happen last week.
hey @RadhiFadlillah thanks a lot for your great effort for this library, may Allah bless you.
i want use this package as source of our application prayer times, but when it compared to kemenag official prayer times the result was different. here is my code without any corrections config:
// Calculate prayer schedule in Bekasi for 2023.
asiaJakarta, _ := time.LoadLocation("Asia/Jakarta")
bekasiSchedules, _ := prayer.Calculate(prayer.Config{
Latitude: -6.241586,
Longitude: 106.992416,
Timezone: asiaJakarta,
TwilightConvention: prayer.Kemenag(),
AsrConvention: prayer.Shafii,
PreciseToSeconds: true,
Corrections: prayer.ScheduleCorrections{},
}, 2023)
the result was
========== 2023-11-30 ==========
fajr: 2023-11-30 04:02:46 +0700 WIB
dhuhr: 2023-11-30 11:40:28 +0700 WIB
asr: 2023-11-30 15:05:46 +0700 WIB
maghrib: 2023-11-30 17:54:07 +0700 WIB
isha: 2023-11-30 19:09:23 +0700 WIB
====================================
wether in kemenag the result was like this
the data shows
my question is, is this expected and we need to fill the corrections config?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.