orthocal

package module
v0.0.0-...-44bb2b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 10 Imported by: 3

README

orthocal

NOTE: Development on this repo has ceased. The project has been rewritten in python and is available at orthocal-python.

Orthocal provides Go tools for the Orthodox Calendar. This code is based on the orthodox_calendar project by Paul Kachur.

TODO

  • Come up with a solution for composite readings
  • Add support for saint levels.
  • if Saturday bef Theophany is Eve, move daily readings

Documentation

Index

Constants

View Source
const (
	Sunday = iota
	Monday
	Tuesday
	Wednesday
	Thursday
	Friday
	Saturday
)
View Source
const (
	NoFast = iota
	Fast
	LentenFast
	ApostlesFast
	DormitionFast
	NativityFast
)

Variables

View Source
var BookNames = map[string]string{}/* 150 elements not displayed */
View Source
var FastExceptions = map[int]string{
	1:  "Wine and Oil are Allowed",
	2:  "Fish, Wine and Oil are Allowed",
	3:  "Wine and Oil are Allowed",
	4:  "Fish, Wine and Oil are Allowed",
	5:  "Wine is Allowed",
	6:  "Wine, Oil and Caviar are Allowed",
	7:  "Meat Fast",
	8:  "Strict Fast (Wine and Oil)",
	9:  "Strict Fast",
	10: "No overrides",
	11: "Fast Free",
}
View Source
var FastLevels = map[int]string{
	NoFast:        "No Fast",
	Fast:          "Fast",
	LentenFast:    "Lenten Fast",
	ApostlesFast:  "Apostles Fast",
	DormitionFast: "Dormition Fast",
	NativityFast:  "Nativity Fast",
}
View Source
var FeastLevels = map[int]string{
	-1: "No Liturgy",
	0:  "Liturgy",
	1:  "Presanctified",
	2:  "Black squigg (6-stich typikon symbol)",
	3:  "Red squigg (doxology typikon symbol)",
	4:  "Red cross (polyeleos typikon symbol)",
	5:  "Red cross half-circle (vigil typikon symbol)",
	6:  "Red cross circle (great feast typikon symbol)",
	7:  "Major feast Theotokos",
	8:  "Major feast Lord",
}

Functions

func ComputeGregorianPascha

func ComputeGregorianPascha(year int) (time.Time, error)

Compute the Gregorian date of Pascha for the given year. The year must be between 2001 and 2099.

func ComputeJulianPascha

func ComputeJulianPascha(year int) (int, int)

Compute the Julian date of Pascha for the given year.

func ComputeJulianPaschaDistance

func ComputeJulianPaschaDistance(year, month, day int) (int, int)

Compute the distance of a given day from Pascha. Returns the distance and the year. If the distance is < -77, the returned year will be earlier than the one passed in.

func ComputePaschaDistance

func ComputePaschaDistance(year, month, day int) (int, int)

Compute the distance of a given day from Pascha. Returns the distance and the year. If the distance is < -77, the returned year will be earlier than the one passed in.

func ComputePaschaJDN

func ComputePaschaJDN(year int) int

Compute the Julian day number of Pascha for the given year.

func GregorianDateToJDN

func GregorianDateToJDN(year, month, day int) int

Convert a Gregorian date to a Julian day number. This function mimic's PHP's gregoriantojd().

func GregorianToJulian

func GregorianToJulian(year, month, day int) (time.Time, error)

Convert a Gregorian date to a Julian date.

func JulianDateToJDN

func JulianDateToJDN(year, month, day int) int

Convert a Julian date to a Julian day number.

func JulianToGregorian

func JulianToGregorian(year, month, day int) (time.Time, error)

Convert a Julian date to a Gregorian date.

func NormalizeBookName

func NormalizeBookName(name string) string

func SurroundingWeekends

func SurroundingWeekends(distance int) (int, int, int, int)

func WeekDayFromPDist

func WeekDayFromPDist(distance int) int

Return the day of the week given the distance from Pascha.

Types

type Bible

type Bible interface {
	Lookup(reference string) Passage
	LookupWithContext(ctx context.Context, reference string) Passage
}

type Day

type Day struct {
	PDist             int       `json:"pascha_distance"`
	JDN               int       `json:"julian_day_number"`
	Year              int       `json:"year"`
	Month             int       `json:"month"`
	Day               int       `json:"day"`
	Weekday           int       `json:"weekday"`
	Tone              int       `json:"tone"`
	Titles            []string  `json:"titles"`
	FeastLevel        int       `json:"feast_level"`
	FeastLevelDesc    string    `json:"feast_level_description"`
	Feasts            []string  `json:"feasts"`
	FastLevel         int       `json:"fast_level"`
	FastLevelDesc     string    `json:"fast_level_desc"`
	FastException     int       `json:"fast_exception"`
	FastExceptionDesc string    `json:"fast_exception_desc"`
	Saints            []string  `json:"saints"`
	ServiceNotes      []string  `json:"service_notes"`
	Readings          []Reading `json:"readings"`
	// contains filtered or unexported fields
}

func (*Day) HasNoMemorial

func (self *Day) HasNoMemorial() bool

type DayFactory

type DayFactory struct {
	// contains filtered or unexported fields
}

func NewDayFactory

func NewDayFactory(useJulian bool, doJump bool, db *sql.DB) *DayFactory

func (*DayFactory) LookupComposite

func (self *DayFactory) LookupComposite(num int) (passage Passage)

func (*DayFactory) NewDay

func (self *DayFactory) NewDay(year, month, day int, bible Bible) *Day

func (*DayFactory) NewDayWithContext

func (self *DayFactory) NewDayWithContext(ctx context.Context, year, month, day int, bible Bible) *Day

type Passage

type Passage []Verse

type Reading

type Reading struct {
	Source       string  `json:"source"`
	Book         string  `json:"book"`
	Description  string  `json:"description"`
	Display      string  `json:"display"`
	ShortDisplay string  `json:"short_display"`
	Passage      Passage `json:"passage"`
}

type Verse

type Verse struct {
	Book    string `json:"book"`
	Chapter uint16 `json:"chapter"`
	Verse   uint16 `json:"verse"`
	Content string `json:"content"`
}

type Year

type Year struct {
	Year int

	Pascha         int // Julian Day Number (JDN)
	PreviousPascha int
	NextPascha     int

	// These measure the distance from Pascha (PDist)
	Finding              int
	Annunciation         int
	PeterAndPaul         int
	Beheading            int
	NativityTheotokos    int
	Elevation            int
	FathersSix           int
	FathersSeven         int
	DemetriusSaturday    int
	SynaxisUnmercenaries int
	Nativity             int
	Forefathers          int
	Theophany            int

	ExtraSundays int

	// This is the number of days after the Elevation?
	LucanJump int

	Reserves   []int
	Paremias   []int
	NoParemias []int
	// contains filtered or unexported fields
}

func NewYear

func NewYear(year int, useJulian bool) *Year

func (*Year) DateToPDist

func (self *Year) DateToPDist(month, day, year int) int

func (*Year) HasNoDailyReadings

func (self *Year) HasNoDailyReadings(pdist int) bool

func (*Year) HasNoParemias

func (self *Year) HasNoParemias(pdist int) bool

func (*Year) HasParemias

func (self *Year) HasParemias(pdist int) bool

func (*Year) LookupFloatIndex

func (self *Year) LookupFloatIndex(pdist int) int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL