- Notifications
You must be signed in to change notification settings - Fork0
Jewish dates conversion tool
License
NotificationsYou must be signed in to change notification settings
simolev/caleb
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Jewish dates conversion tool
go get github.com/simolev/caleb
package mainimport ("fmt""github.com/simolev/caleb""time")funcmain() {j1:= caleb.JewishDate{Shana:5779,Chodesh:7,Yom:25}// 25 Adar II 5779g1:=caleb.JewishToGregorian(j1)//fmt.Println(j1,"=>",g1.Format("2006-01-02"))// 25 Adar II 5779 => 2019-04-01g2:=time.Date(2018,8,11,0,0,0,0,time.UTC)// 2018-08-11j2:=caleb.GregorianToJewish(g2)//fmt.Println(g2.Format("2006-01-02"),"=>",j2)// 2018-08-11 => 30 Av 5778}
a) It is not accurate for dates before Gregorian1582-10-15. In the Gregorian calendar, there are 10 missing days between 1582-10-15 and 1582-10-04. Those days never occurred, but nonetheless they seem to exist in go's implementation, and the only solution I see at the moment would be to add manual correction to the algorithm.
b) This is quite new and would require more thorough testing before being relied upon.
c) Code could be more idiomatic and optimized.
Thanks toinfo@dafaweek.com.
Converted from #"http://www.dafaweek.com/HebCal/HebCalSampleSource.php" rel="nofollow">http://www.dafaweek.com/HebCal/HebCalSampleSource.php
See alsohttp://www.dafaweek.com/hebcal/hebcalvb6.php