Documentation ¶
Overview ¶
Package caleb provides a JewishDate type and conversion to and from time.Time
package main import ( "fmt" "github.com/simolev/caleb" "time" ) func main() { j1 := caleb.JewishDate{Shana: 5779, Chodesh: 7, Yom: 25} // 25 Adar II 5779 g1 := caleb.JewishToGregorian(j1) // fmt.Println(j1, "=>", g1.Format("2006-01-02")) // 25 Adar II 5779 => 2019-04-01 g2 := time.Date(2018, 8, 11, 0, 0, 0, 0, time.UTC) // 2018-08-11 j2 := caleb.GregorianToJewish(g2) // fmt.Println(g2.Format("2006-01-02"), "=>", j2) // 2018-08-11 => 30 Av 5778 }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DaysInShana ¶
DaysInShana return the number of days in the passed shana.
func IsMehubberet ¶
Shana Mehubberet has 13 months instead of 12 and occurs on years 3, 6, 8, 11, 14, 17, 19 of a 19 year cycle.
func JewishToGregorian ¶
func JewishToGregorian(j JewishDate) (gregorian time.Time)
JewishToGregorian accepts a JewishDate struct and returns the corresponding gregorian date in time.Time format. Only the date part is relevant, time will be 0 and timezone UTC.
func MonthsSinceFirstMolad ¶
MonthsSinceFirstMolad returns the number of months since the very first Molad until the beginning of the passed shana.
func RoshHashana ¶
RoshHashana returns the gregorian day for Rosh Hashana (1st of Tishri) of the passed shana.
Types ¶
type JewishDate ¶
func GregorianToJewish ¶
func GregorianToJewish(dGreg time.Time) JewishDate
GregorianToJewish accepts a gregorian date in time.Time format and returns a JewishDate struct. Only the date part is relevant, time and timezone are discarded.
func (JewishDate) Serialize ¶
func (t JewishDate) Serialize() (Shana int, Chodesh int, Yom int)
Serialize returns the components Shana, Chodesh, Yom.
func (JewishDate) Short ¶
func (t JewishDate) Short() string
Short returns a numerical representation of the Jewish date: 5779-07-25.
func (JewishDate) String ¶
func (t JewishDate) String() string
String returns a representation of the Jewish date where the month is spelled out: 25 Adar II 5779.