Documentation
¶
Index ¶
- Variables
- func AsEvent[T event.CalEvent](e event.CalEvent) *T
- func CalOptionsFuncs(opts *hebcal.CalOptions) map[string]any
- func CompareTimedEvents(events []hebcal.TimedEvent) func(i, j int) bool
- func DatePartsEqual(a, b time.Time) bool
- func ForDate(loc *zmanim.Location) func(d time.Time) (*zmanim.Zmanim, error)
- func ForLocationDate(loc *zmanim.Location, d time.Time) (*zmanim.Zmanim, error)
- func Ftoi(f float64) int
- func Hebcal(opts *hebcal.CalOptions) func(dates ...hdate.HDate) ([]event.CalEvent, error)
- func HebcalFuncs(opts *hebcal.CalOptions) map[string]any
- func Itof(i int) float64
- func LookupCity(city string) (*zmanim.Location, error)
- func ParseFile(files fs.FS, tmpl *template.Template, fpath string) (*template.Template, error)
- func SecondsDuration(secs float64) time.Duration
- func Sedra(year int, il bool) *sedra.Sedra
- func SetDates(opts *hebcal.CalOptions) func(dates ...hdate.HDate) (any, error)
- func SetEnd(opts *hebcal.CalOptions) func(hd hdate.HDate) any
- func SetFuncMap(tmpl interface{ ... }, opts *hebcal.CalOptions) *template.Template
- func SetIsHebrewYear(opts *hebcal.CalOptions) func(b bool) any
- func SetNumYears(opts *hebcal.CalOptions) func(n int) any
- func SetStart(opts *hebcal.CalOptions) func(hd hdate.HDate) any
- func SetYear(opts *hebcal.CalOptions) func(y int) any
- func TimedEvents(opts *hebcal.CalOptions) func(dates ...hdate.HDate) ([]hebcal.TimedEvent, error)
- func ZmanimFuncs(opts *hebcal.CalOptions) map[string]any
Constants ¶
This section is empty.
Variables ¶
var CastFuncs = map[string]any{ "itof": Itof, "ftoi": Ftoi, }
var EnvFuncs = map[string]any{ "getenv": os.Getenv, }
var EventConsts = map[string]any{ "CHAG": event.CHAG, "LIGHT_CANDLES": event.LIGHT_CANDLES, "YOM_TOV_ENDS": event.YOM_TOV_ENDS, "CHUL_ONLY": event.CHUL_ONLY, "IL_ONLY": event.IL_ONLY, "LIGHT_CANDLES_TZEIS": event.LIGHT_CANDLES_TZEIS, "CHANUKAH_CANDLES": event.CHANUKAH_CANDLES, "ROSH_CHODESH": event.ROSH_CHODESH, "MINOR_FAST": event.MINOR_FAST, "SPECIAL_SHABBAT": event.SPECIAL_SHABBAT, "PARSHA_HASHAVUA": event.PARSHA_HASHAVUA, "DAF_YOMI": event.DAF_YOMI, "OMER_COUNT": event.OMER_COUNT, "MODERN_HOLIDAY": event.MODERN_HOLIDAY, "MAJOR_FAST": event.MAJOR_FAST, "SHABBAT_MEVARCHIM": event.SHABBAT_MEVARCHIM, "MOLAD": event.MOLAD, "USER_EVENT": event.USER_EVENT, "HEBREW_DATE": event.HEBREW_DATE, "MINOR_HOLIDAY": event.MINOR_HOLIDAY, "EREV": event.EREV, "CHOL_HAMOED": event.CHOL_HAMOED, "MISHNA_YOMI": event.MISHNA_YOMI, "YOM_KIPPUR_KATAN": event.YOM_KIPPUR_KATAN, "ZMANIM": event.ZMANIM, "YERUSHALMI_YOMI": event.YERUSHALMI_YOMI, "NACH_YOMI": event.NACH_YOMI, }
var HDateConsts = map[string]any{ "Nisan": hdate.Nisan, "Iyyar": hdate.Iyyar, "Sivan": hdate.Sivan, "Tamuz": hdate.Tamuz, "Av": hdate.Av, "Elul": hdate.Elul, "Tishrei": hdate.Tishrei, "Cheshvan": hdate.Cheshvan, "Kislev": hdate.Kislev, "Tevet": hdate.Tevet, "Shvat": hdate.Shvat, "Adar1": hdate.Adar1, "Adar2": hdate.Adar2, "Epoch": hdate.Epoch, }
var HDateFuncs = map[string]any{ "hdateEqual": xhdate.Equal, "hdateParse": xhdate.Parse, "hdateIsLeapYear": hdate.IsLeapYear, "hdateMonthsInYear": hdate.MonthsInYear, "hdateDaysInYear": hdate.DaysInYear, "hdateLongCheshvan": hdate.LongCheshvan, "hdateShortKislev": hdate.ShortKislev, "hdateDaysInMonth": hdate.DaysInMonth, "hdateToRD": hdate.ToRD, "hdateNew": hdate.New, "hdateFromRD": hdate.FromRD, "hdateFromGregorian": hdate.FromGregorian, "hdateFromProlepticGregorian": hdate.FromProlepticGregorian, "hdateFromTime": hdate.FromTime, "hdateMonthFromName": hdate.MonthFromName, "hdateDayOnOrBefore": hdate.DayOnOrBefore, }
var SedraConsts = map[string]any{
"Bereshit": 1,
"Noach": 2,
"LechLecha": 3,
"Vayera": 4,
"ChayeiSara": 5,
"Toldot": 6,
"Vayetzei": 7,
"Vayishlach": 8,
"Vayeshev": 9,
"Miketz": 10,
"Vayigash": 11,
"Vayechi": 12,
"Shemot": 13,
"Vaera": 14,
"Bo": 15,
"Beshalach": 16,
"Yitro": 17,
"Mishpatim": 18,
"Terumah": 19,
"Tetzaveh": 20,
"KiTisa": 21,
"Vayakhel": 22,
"Pekudei": 23,
"Vayikra": 24,
"Tzav": 25,
"Shmini": 26,
"Tazria": 27,
"Metzora": 28,
"AchreiMot": 29,
"Kedoshim": 30,
"Emor": 31,
"Behar": 32,
"Bechukotai": 33,
"Bamidbar": 34,
"Nasso": 35,
"Behaalotcha": 36,
"Shlach": 37,
"Korach": 38,
"Chukat": 39,
"Balak": 40,
"Pinchas": 41,
"Matot": 42,
"Masei": 43,
"Devarim": 44,
"Vaetchanan": 45,
"Eikev": 46,
"Reeh": 47,
"Shoftim": 48,
"KiTeitzei": 49,
"KiTavo": 50,
"Nitzavim": 51,
"Vayeilech": 52,
"Haazinu": 53,
}
var SedraFuncs = map[string]any{ "sedra": Sedra, }
var StringFuncs = map[string]any{ "contains": strings.Contains, "containsAny": strings.ContainsAny, "count": strings.Count, "equalFold": strings.EqualFold, "hasPrefix": strings.HasPrefix, "hasSuffix": strings.HasSuffix, "stringsIndex": strings.Index, "stringsIndexAny": strings.IndexAny, "join": strings.Join, "lastIndex": strings.LastIndex, "lastIndexAny": strings.LastIndexAny, "lines": strings.Lines, "repeat": strings.Repeat, "replace": strings.Replace, "replaceAll": strings.ReplaceAll, "split": strings.Split, "splitAfter": strings.SplitAfter, "splitAfterN": strings.SplitAfterN, "splitAfterSeq": strings.SplitAfterSeq, "splitN": strings.SplitN, "splitSeq": strings.SplitSeq, "toLower": strings.ToLower, "toTitle": strings.ToTitle, "toUpper": strings.ToUpper, "toValidUTF8": strings.ToValidUTF8, "trim": strings.Trim, "trimLeft": strings.TrimLeft, "tripPrefix": strings.TrimPrefix, "trimRight": strings.TrimRight, "trimSpace": strings.TrimSpace, "trimSuffix": strings.TrimSuffix, }
var TimeConsts = map[string]any{ "Hour": time.Hour, "Minute": time.Minute, "Second": time.Second, "Millisecond": time.Millisecond, "Microsecond": time.Microsecond, "Nanosecond": time.Nanosecond, "Layout": time.Layout, "ANSIC": time.ANSIC, "UnixDate": time.UnixDate, "RubyDate": time.RubyDate, "RFC822": time.RFC822, "RFC822Z": time.RFC822Z, "RFC850": time.RFC850, "RFC1123": time.RFC822, "RFC1123Z": time.RFC822Z, "RFC3339": time.RFC3339, "RFC3339Nano": time.RFC3339Nano, "Kitchen": time.Kitchen, "Stamp": time.Stamp, "StampMilli": time.StampMilli, "StampMicro": time.StampMicro, "StampNano": time.StampNano, "DateTime": time.DateTime, "DateOnly": time.DateOnly, "TimeOnly": time.TimeOnly, "January": time.January, "February": time.February, "March": time.March, "April": time.April, "May": time.May, "June": time.June, "July": time.July, "August": time.August, "September": time.September, "October": time.October, "November": time.November, "December": time.December, "Sunday": time.Sunday, "Monday": time.Monday, "Tuesday": time.Tuesday, "Wednesday": time.Wednesday, "Thursday": time.Thursday, "Friday": time.Friday, "Saturday": time.Saturday, }
var TimeFuncs = map[string]any{ "secondsDuration": SecondsDuration, "timeParseDuration": time.ParseDuration, "timeSince": time.Since, "timeUntil": time.Until, "timeFixedZone": time.FixedZone, "timeLoadLocation": time.LoadLocation, "timeParse": time.Parse, "timeParseInLocation": time.ParseInLocation, "timeUnix": time.Unix, "timeUnixMicro": time.UnixMicro, "timeUnixMilli": time.UnixMilli, "timeDate": time.Date, "datePartsEqual": DatePartsEqual, }
Functions ¶
func AsEvent ¶
AsEvent attempts to convert an event.CalEvent interface to its underlying concrete type. If the conversion fails, it returns nil.
func CalOptionsFuncs ¶ added in v0.0.2
func CalOptionsFuncs(opts *hebcal.CalOptions) map[string]any
CalOptionsFuncs contains functions for Modifying opts from a template.
func CompareTimedEvents ¶ added in v0.0.2
func CompareTimedEvents(events []hebcal.TimedEvent) func(i, j int) bool
CompareTimedEvents allows hebcal.TimedEvents to be sorted. When clock times match, ties are broken by prioritizing Havdalah first and Candle lighting last. For example:
sort.Slice(events, CompareTimedEvents(events))
func DatePartsEqual ¶
DatePartsEqual compares the year, month, and day of two [time.Time]s and returns true if those parts all match.
func ForDate ¶ added in v0.0.2
ForDate takes a zmanim.Location and returns a constructor for new zmanim.Zmanim objects with different dates in that Location. Unlike zmanim.New which can panic and returns a struct, this constructor returns a struct pointer and an error.
func ForLocationDate ¶ added in v0.0.2
ForLocationDate creates a new zmanim.Zmanim object. Unlike zmanim.New which can panic and returns a struct, this constructor returns a struct pointer and an error.
func Hebcal ¶ added in v0.0.2
Hebcal returns a slice of event.CalEvent like the original hebcal program. If no dates are provided, it uses the hebcal.CalOptions to select a date range. If one date is provided, only the events for that day are returned. If two dates, all the events between them are returned, including those on the end date.
func HebcalFuncs ¶
func HebcalFuncs(opts *hebcal.CalOptions) map[string]any
func LookupCity ¶ added in v0.0.2
LookupCity is the same as zmanim.LookupCity, except that we return an error if no match is found.
func SecondsDuration ¶
SecondsDuration converts float64 seconds into a time.Duration.
func Sedra ¶ added in v0.0.2
Sedra returns a sedra.Sedra which can be used to query for the Parasha of the week.
func SetDates ¶ added in v0.0.2
SetDates configures the opts with the provided dates. If no dates are provided, it does nothing. If one date is provided, it sets both opts.Start and opts.End to select that single date. If two dates, it checks that the first date is before the second, and sets opts.Start with the first and opts.End with the second. If more dates are provided, we return an error.
func SetEnd ¶
func SetEnd(opts *hebcal.CalOptions) func(hd hdate.HDate) any
SetEnd tells template functions like hebcal and timedEvents the date through which events should be returned.
func SetFuncMap ¶
func SetIsHebrewYear ¶
func SetIsHebrewYear(opts *hebcal.CalOptions) func(b bool) any
SetIsHebrewYear tells template functions like hebcal and timedEvents how to interpret the Year and NumYears fields.
func SetNumYears ¶
func SetNumYears(opts *hebcal.CalOptions) func(n int) any
SetNumYears tells template functions like hebcal and timedEvents how many years of events should be returned.
func SetStart ¶
func SetStart(opts *hebcal.CalOptions) func(hd hdate.HDate) any
SetStart tells template functions like hebcal and timedEvents the date from which events should be returned.
func SetYear ¶
func SetYear(opts *hebcal.CalOptions) func(y int) any
SetYear tells template functions like hebcal and timedEvents the starting year from which events should be returned.
func TimedEvents ¶
func TimedEvents( opts *hebcal.CalOptions, ) func(dates ...hdate.HDate) ([]hebcal.TimedEvent, error)
TimedEvents uses the given opts and returns just the [event.CalEvent]s which are [hebcal.TimedEvent]s. This is an easy way to pull zmanim from Hebcal, if you don't want to fully customize your zmanim list yourself. This interface is very similar to the one provided by the classic hebcal binary.
Unlike Hebcal, results are sorted by time, and certain ties are broken by putting Havdalah first and Candle lighting last.
If no dates are provided, it uses the hebcal.CalOptions to select a date range. If one date is provided, only the events for that day are returned. If two dates, all the events between them are returned, including those on the end date.
func ZmanimFuncs ¶ added in v0.0.2
func ZmanimFuncs(opts *hebcal.CalOptions) map[string]any
Types ¶
This section is empty.