libcalendar

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: GPL-3.0 Imports: 9 Imported by: 1

README

libcalendar - Calendrical calculations in Go

About

libcalendar is a translation into Go of the Lisp code described and presented in:

libcalendar allows the computation of and conversion between dates from 11 calendars: Gregorian, ISO, Julian, Islamic, Hebrew, Mayan (long count, haab, tzolkin), French Revolutionary, and Old Hindu (solar, lunar).

Installing

Install the latest version of libcalendar via go get

go get staudtlex.de/libcalendar

Import libcalendar in your application

import staudtlex.de/libcalendar

Examples

Basic examples can be found in utility_test.go, further examples may be added in the future.

Limitations

The primary motivation for writing libcalendar was to take first steps in understanding calendar-related algorithms and Go programming.

  • libcalendar does not implement the code discussed in: Reingold, Edward, and Nachum Dershowitz. 2018. Calendrical Calculations: The Ultimate Edition. 4th edition. Cambridge: Cambridge University Press.

  • The functions implemented in libcalendar do not generally work for absolute dates smaller than 1 (except the Mayan calendars).

  • Furthermore, the Islamic and French Revolutionary calendar functions do not work with dates prior to their respective epochs. If provided with such dates, the functions may return invalid results.

  • DaylightSavingsStart and DaylightSavingsEnd use the US rules for determining start and end of DST which are in place since 2007, whereas the corresponding Lisp-functions use the pre-2007 rules.

  • For some dates, the Old Hindu solar and lunar calendar functions return results that are off by one day compared to those produced by the (more recent) Lisp-Code in Reingold/Dershowitz (2018).

Documentation

Overview

Package libcalendar implements functions to compute and convert dates from various calendars. These are the Gregorian, ISO, Julian, Islamic, Hebrew, Mayan (long count, haab, tzolkin), French Revolutionary, and Old Hindu (solar, lunar) calendars.

The calendrical algorithms are a translation of the Lisp code discussed in:

Dershowitz, Nachum, and Edward Reingold. 1990. "Calendrical Calculations", Software - Practice and Experience, 20 (9), 899-928. https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.17.4274

Reingold, Edward, Nachum Dershowitz, and Stewart Clamen. 1993. "Calendrical Calculations, II: Three Historical Calendars", Software - Practice & Experience, 23 (4), 383-404. https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.13.9215

Example

Convert from a Gregorian date to the corresponding date of the Julian, ISO, Islamic, Hebrew, French Revolutionary, Mayan (long count, haab, tzolkin), and Old Hindu (solar, lunar) calendars.

package main

import (
	"fmt"

	lc "staudtlex.de/libcalendar"
)

func main() {
	// Convert dates
	// 1. set Gregorian date
	gregorianDate := lc.GregorianDate{Year: 2022, Month: 06, Day: 15}

	// 2. convert Gregorian date to absolute (fixed) date
	absoluteDate := lc.AbsoluteFromGregorian(gregorianDate)

	// 3. convert absolute dates into corresponding calendar dates
	fmt.Println("Converting from a Gregorian date to other calendar dates")
	fmt.Println("Gregorian:\t\t", gregorianDate)
	fmt.Println("Absolute date:\t\t", absoluteDate)
	fmt.Println("Julian:\t\t\t", lc.JulianFromAbsolute(absoluteDate))
	fmt.Println("ISO:\t\t\t", lc.IsoFromAbsolute(absoluteDate))
	fmt.Println("Islamic:\t\t", lc.IslamicFromAbsolute(absoluteDate))
	fmt.Println("Hebrew:\t\t\t", lc.HebrewFromAbsolute(absoluteDate))
	fmt.Println("French Revolutionary:\t", lc.FrenchFromAbsolute(absoluteDate))
	fmt.Println("Mayan Long Count:\t", lc.MayanLongCountFromAbsolute(absoluteDate))
	fmt.Println("Mayan Haab:\t\t", lc.MayanHaabFromAbsolute(absoluteDate))
	fmt.Println("Mayan Tzolkin:\t\t", lc.MayanTzolkinFromAbsolute(absoluteDate))
	fmt.Println("Hindu Solar:\t\t", lc.OldHinduSolarFromAbsolute(absoluteDate))
	fmt.Println("Hindu Lunar:\t\t", lc.OldHinduLunarFromAbsolute(absoluteDate))

	// Utility functions
	// 1. Marshal a Date to JSON:
	gregorian_json := gregorianDate.Date().Json()
	fmt.Println(gregorian_json)

	// 2. Unmarshal JSON into a Date
	json_1 := `{
		"components": [2022,6,15],
		"calendar": "gregorian",
		"componentNames" :[],
		"monthNames": []
	}`
	fmt.Println(json_1)
	unmarshal_json_1 := lc.JsonToDate(json_1)
	fmt.Println(unmarshal_json_1)

	// 3. Convert a Date to an absolute date, and compute a Mayan Long count
	// date from that absolute date
	mayanLongCount :=
		lc.FromAbsolute(
			lc.AbsoluteFromDate(unmarshal_json_1), "mayanLongCount")
	fmt.Println("Mayan long count: ", mayanLongCount)
}
Output:

Index

Examples

Constants

View Source
const (
	// Special tokens
	ILLEGAL token = iota
	EOF
	WS

	// Literals
	NAME_OR_STRING
	CALENDAR
	COMPONENTS
	ARRAY
	DIGITS

	// Misc characters
	COMMA // ,
	COLON // :
)
View Source
const MayanDaysBeforeAbsoluteZero float64 = 1137142

Number of days of the Mayan calendar epoch before absolute day 0, according to the Goodman-Martinez-Thompson correlation (see Reingold/Dershowitz 2018).

Variables

View Source
var LunarSiderealMonth = add(big.NewRat(27, 1), big.NewRat(4644439, 14438334))
View Source
var LunarSynodicMonth = add(big.NewRat(29, 1), big.NewRat(7087771, 13358334))
View Source
var SolarMonth = div(SolarSiderealYear, big.NewRat(12, 1))
View Source
var SolarSiderealYear = add(big.NewRat(365, 1), big.NewRat(279457, 1080000))

Functions

func AbsoluteFromDate

func AbsoluteFromDate(d Date) (absoluteDate float64)

AbsoluteFromDate returns the absolute (fixed) date from a given calendar date. Note that no checks are performed as to whether the given date is valid, i.e. in the date range for which the calendar was defined. For instance, conversion of dates preceding the 19.07.622 (1 Muharram 1 A.H.) into the Islamic calendar or dates preceding the 22.09.1792 (1 Vendémiare an 1) may yield non-sensical results.

func AbsoluteFromFrench

func AbsoluteFromFrench(d FrenchDate) (absoluteDate float64)

AbsoluteFromFrench returns the absolute (fixed) date from a given French Revolutionary date.

func AbsoluteFromGregorian

func AbsoluteFromGregorian(d GregorianDate) (absoluteDate float64)

AbsoluteFromGregorian computes the absolute (fixed) date from a Gregorian date.

func AbsoluteFromHebrew

func AbsoluteFromHebrew(d HebrewDate) (absoluteDate float64)

AbsoluteFromHebrew computes the absolute (fixed) date from a given Hebrew date.

func AbsoluteFromIslamic

func AbsoluteFromIslamic(d IslamicDate) (absoluteDate float64)

AbsoluteFromIslamic computes the absolute date corresponding to a given Islamic date.

func AbsoluteFromIso

func AbsoluteFromIso(d IsoDate) (absoluteDate float64)

AbsoluteFromIso computes the absolute (fixed) date from an ISO date.

func AbsoluteFromJulian

func AbsoluteFromJulian(d JulianDate) (absoluteDate float64)

AbsoluteFromJulian computes the absolute (fixed) date corresponding to a given Julian date.

func AbsoluteFromMayanLongCount

func AbsoluteFromMayanLongCount(d MayanLongCount) (date float64)

AbsoluteFromMayanLongCount returns the absolute (fixed) date of a given Mayan long count.

func AbsoluteFromOldHinduLunar

func AbsoluteFromOldHinduLunar(d OldHinduLunarDate) (absoluteDate float64)

AbsoluteFromOldHinduLunar returns the absolute (fixed) date corresponding to a given Old Hindu lunar date.

func AbsoluteFromOldHinduSolar

func AbsoluteFromOldHinduSolar(d OldHinduSolarDate) (absoluteDate float64)

AbsoluteFromOldHinduSolar returns the absolute (fixed) date from a given Old Hindu solar date.

func Advent

func Advent(year float64) (absoluteDate float64)

Advent returns the absolute (fixed) date of Advent in a given Gregorian year.

func Christmas

func Christmas(year float64) (absoluteDate float64)

Christmas returns the absolute (fixed) date of Gregorian Christmas in a given Gregorian year.

func DaylightSavingsEnd

func DaylightSavingsEnd(year float64) (absoluteDate float64)

DaylightSavingsEnd returns the absolute (fixed) date of the end of US daylight savings time.

func DaylightSavingsStart

func DaylightSavingsStart(year float64) (absoluteDate float64)

DaylightSavingsStart returns the absolute (fixed) date of the start of US daylight savings time.

func DaysInHebrewYear

func DaysInHebrewYear(year float64) (days float64)

DaysInHebrewYear computes the number of days in a given Hebrew year.

func Easter

func Easter(year float64) (absoluteDate float64)

Easter computes the absolute (fixed) date of Easter in a given Gregorian year.

func EasternOrthodoxChristmas

func EasternOrthodoxChristmas(year float64) (absoluteDates []float64)

EasternOrthodoxChristmas returns the absolute (fixed) date of Eastern Orthodox Christmas in a given Gregorian year.

func Epiphany

func Epiphany(year float64) (absoluteDate float64)

Epiphany returns the absolute (fixed) date of Epiphany in a given Gregorian year.

func FrenchLastDayOfMonth

func FrenchLastDayOfMonth(month, year float64) (day float64)

FrenchLastDayOfMonth returns the last day of a given French Revolutionary month in a given French Revolutionary year

func FrenchLeapYear

func FrenchLeapYear(year float64) bool

FrenchLeapYear returns true if a given year is a leap year, and false otherwise

func FromAbsolute

func FromAbsolute(absoluteDate float64, calendar string) string

FromAbsolute returns a string-formatted calendar date from a given absolute date and calendar name.

func HebrewBirthday

func HebrewBirthday(birthdate HebrewDate, year float64) (absoluteDate float64)

HebrewBirthday determines the absolute (fixed) date of the anniversary of a given Hebrew birth date in a given Hebrew year.

func HebrewCalendarElapsedDays

func HebrewCalendarElapsedDays(year float64) (days float64)

HebrewCalendarElapsedDays computes the number of days elapsed from the Sunday prior to the start of the Hebrew calendar to the mean conjunction of Tishri of a given Hebrew year.

func HebrewLeapYear

func HebrewLeapYear(year float64) bool

HebrewLeapYear returns true if year is a Hebrew leap year.

func HebrewMonthNames

func HebrewMonthNames(d HebrewDate) []string

HebrewMonthNames returns the month names for a given Hebrew year, taking into account the Hebrew leap year rule.

func IndependenceDay

func IndependenceDay(year float64) (absoluteDate float64)

IndependenceDay returns the absolute (fixed) date of the US Independence Day.

func IslamicDatesInGregorianYear

func IslamicDatesInGregorianYear(month float64, day float64, year float64) (absoluteDates []float64)

IslamicDatesInGregorianYear returns a slice of absolute dates of a given Islamic date (month, day) that occur in a given Gregorian year.

func IslamicLeapYear

func IslamicLeapYear(year float64) bool

IslamicLeapYear returns true if a given Islamic year is leap, and false otherwise.

func JsonDateFromAbsolute

func JsonDateFromAbsolute(rd float64, calendar string) string

JsonDateFromAbsolute converts a given absolute (fixed) date into the date representation specified in `calendar`. It returns a Date marshalled into a JSON-string.

func KDayOnOrBefore

func KDayOnOrBefore(absoluteDate float64, k float64) float64

KDayOnOrBefore computes the absolute date of a given week day in the seven-day interval ending on date.

func LaborDay

func LaborDay(year float64) (absoluteDate float64)

LaborDay returns the absolute (fixed) date of US Labor Day in a given Gregorian year.

func LastDayOfGregorianMonth

func LastDayOfGregorianMonth(month float64, year float64) (day float64)

LastDayOfGregorianMonth returns the last day (number of days) of a given Gregorian month.

func LastDayOfHebrewMonth

func LastDayOfHebrewMonth(month float64, year float64) (day float64)

LastDayOfHebrewMonth returns the day (number of days) of a given Hebrew month.

func LastDayOfIslamicMonth

func LastDayOfIslamicMonth(month float64, year float64) (day float64)

LastDayOfIslamicMonth determines the last day of an Islamic month.

func LastDayOfJulianMonth

func LastDayOfJulianMonth(month float64, year float64) (day float64)

LastDayOfJulianMonth returns the last day (number of days) of a given Julian month.

func LastMonthOfHebrewYear

func LastMonthOfHebrewYear(year float64) (month float64)

LastMonthOfHebrewYear returns the last month of a given Hebrew year.

func LastValidDayOfMonth

func LastValidDayOfMonth(year, month, day float64, calendar string) (validDay float64)

lastValidDate checks if the day provided in the parameters is valid for a given year and month. If the day is valid, returns that day, otherwise returns the last valid day of the given year and month.

func LongHeshvan

func LongHeshvan(year float64) bool

LongHeshvan returns true if Heshvan is long in a given Hebrew year.

func LunarLongitude

func LunarLongitude(t *big.Rat) (degrees *big.Rat)

LunarLongitude returns the sidereal longitude of the moon (in degrees) at a given moment (date and fraction of a day).

func LunarPhase

func LunarPhase(t *big.Rat) (phase float64)

LunarPhase computes the lunar phase of the moon for a given moment (date and fraction of a day).

func MayanHaabDifference

func MayanHaabDifference(d1, d2 MayanHaabDate) (days float64)

MayanHaabDifference computes the number of days between two haab dates.

func MayanHaabOnOrBefore

func MayanHaabOnOrBefore(haab MayanHaabDate, d float64) (date float64)

MayanHaabOnOrBefore returns the absolute (fixed) date of a Mayan haab date on or before a given absolute date.

func MayanHaabTzolkinOnOrBefore

func MayanHaabTzolkinOnOrBefore(haab MayanHaabDate, tzolkin MayanTzolkinDate, d float64) (absoluteDate float64)

MayanHaabTzolkinOnOrBefore returns the absolute date of the latest date on or before a given haab date and a given tzolkin date. Returns NaN when no such combination is found.

func MayanTzolkinDifference

func MayanTzolkinDifference(d1, d2 MayanTzolkinDate) (days float64)

MayanTzolkinDifference returns the number of days between two given Mayan tzolkin dates.

func MemorialDay

func MemorialDay(year float64) (absoluteDate float64)

MemorialDay returns the absolute (fixed) date of US Memorial Day in a given Gregorian year.

func MuladAlNabi

func MuladAlNabi(year float64) (absoluteDates []float64)

MuladAlNabi computes slice of absolute (fixed) dates of Mulad al Nabi that occur in a given Gregorian year.

func NewMoon

func NewMoon(t *big.Rat) *big.Rat

NewMoon determines the time of the most recent new moon for a given moment (date and fraction of day).

func NicaeanRuleEaster

func NicaeanRuleEaster(year float64) (absoluteDate float64)

NicaeanRuleEaster computes the absolute (fixed) date of Easter in a given Julian year.

func NthKDay

func NthKDay(n float64, k float64, month float64, year float64) (absoluteDate float64)

NthKDay computes the absolute (fixed) date of the nth kth day in a given month in a given Gregorian year.

func OldHinduLunarPrecedes

func OldHinduLunarPrecedes(d1, d2 OldHinduLunarDate) bool

OldHinduLunarPrecedes returns true if a given Hindu lunar date d1 precedes (i.e. is smaller than) a given Hindu lunar date d2, and false otherwise.

func Passover

func Passover(year float64) (absoluteDate float64)

Passover returns the abolute (fixed) date of Passover in a given Gregorian year.

func Pentecost

func Pentecost(year float64) (absoluteDate float64)

Pentecost returns the absolute (fixed) date of Pentecost in a given Gregorian year.

func Purim

func Purim(year float64) (absoluteDate float64)

Purim returns the absolute (fixed) date of Purim in a given Gregorian year.

func ShortKislev

func ShortKislev(year float64) bool

ShortKislev returns true if Kislev is short in a given Hebrew year.

func SolarLongitude

func SolarLongitude(t *big.Rat) (degrees *big.Rat)

SolarLongitude returns the position of the sun (in degrees) for a given moment (day and fraction of a day).

func TaAnitEsther

func TaAnitEsther(year float64) (absoluteDate float64)

TaAnitEsther returns the absolute (fixed) date of TaAnitEsther in a given Gregorian year.

func TishaBAv

func TishaBAv(year float64) (absoluteDate float64)

TishaBAv returns the absolute (fixed) date of Tisha B'Av in a given Gregorian year.

func Yahrzeit

func Yahrzeit(deathDate HebrewDate, year float64) (absoluteDate float64)

Yahrzeit determines the absolute (fixed) date of the anniversary of a given Hebrew death-date in a given Hebrew year

func YomKippur

func YomKippur(year float64) (absoluteDate float64)

YomKippur returns the absolute (fixed) date of Yom Kippur in a given Gregorian year.

func Zodiac

func Zodiac(t *big.Rat) (zodiac float64)

Zodiac returns the zodiacal sign for a given moment (day and fraction of day).

Types

type Date

type Date struct {
	Calendar       string    `json:"calendar"`       // calendar name, e.g. "gregorian"
	Components     []float64 `json:"components"`     // e.g. []float64{2022, 05, 28}
	ComponentNames []string  `json:"componentNames"` // e.g. []string{"year", "month", "day"}
	MonthNames     []string  `json:"monthNames"`     // e.g. []string{"January", ..., "December"}
}

Date represents a generic container for dates, holding information about arbitrary dates. Possible calendar names are:

func DateFromAbsolute

func DateFromAbsolute(absoluteDate float64, calendar string) Date

DateFromAbsolute converts a given absolute (fixed) date into the date representation specified in `calendar`

func JsonToDate

func JsonToDate(json string) Date

JsonToDate unmarshals a JSON-serialized Date object into a Date struct. Unmarshals only elements "calendar" and "components".

Example
package main

import (
	"fmt"

	lc "staudtlex.de/libcalendar"
)

func main() {
	jsonString := `{
		"components": [2022,6,15],
		"calendar": "gregorian",
		"componentNames" :[],
		"monthNames": []
	}`
	fmt.Println(jsonString)
	unmarshal_json := lc.JsonToDate(jsonString)
	fmt.Println(unmarshal_json)

	// Convert a Date to an absolute date, and compute a Mayan Long count
	// date from that absolute date
	mayanLongCount :=
		lc.FromAbsolute(
			lc.AbsoluteFromDate(unmarshal_json), "mayanLongCount")
	fmt.Println("Mayan long count: ", mayanLongCount)
}
Output:

func (Date) Json

func (d Date) Json() string

Json serializes the receiver into a JSON-formatted string.

Example
package main

import (
	"fmt"

	lc "staudtlex.de/libcalendar"
)

func main() {
	gregorianDate := lc.GregorianDate{Year: 2022, Month: 06, Day: 15}

	gregorian_json := gregorianDate.Date().Json()
	fmt.Println(gregorian_json)
}
Output:

func (Date) String

func (d Date) String() string

String creates a string representation of its receiver.

This function reuses the String() method of GregorianDate{} etc. by internally converting the given Date struct into a GregorianDate{}, IsoDate{} or other appropriate struct.

type FrenchDate

type FrenchDate struct {
	Year  float64
	Month float64
	Day   float64
}

French date type

func FrenchFromAbsolute

func FrenchFromAbsolute(absoluteDate float64) FrenchDate

FrenchFromAbsolute returns the French Revolutionary date corresponding to a given absolute (fixed) date.

func (FrenchDate) Date

func (d FrenchDate) Date() Date

Date() creates a Date from its receiver.

func (FrenchDate) String

func (d FrenchDate) String() string

type GregorianDate

type GregorianDate struct {
	Year  float64
	Month float64
	Day   float64
}

Gregorian date

func GregorianFromAbsolute

func GregorianFromAbsolute(absoluteDate float64) GregorianDate

GregorianFromAbsolute computes the Gregorian date corresponding to a given absolute date.

func (GregorianDate) Date

func (d GregorianDate) Date() Date

Date() creates a Date from its receiver.

func (GregorianDate) String

func (d GregorianDate) String() string

type HebrewDate

type HebrewDate struct {
	Year  float64
	Month float64
	Day   float64
}

Hebrew date

func HebrewFromAbsolute

func HebrewFromAbsolute(absoluteDate float64) HebrewDate

HebrewFromAbsolute computes the Hebrew date corresponding to a given absolute (fixed) date

func (HebrewDate) Date

func (d HebrewDate) Date() Date

Date() creates a Date from its receiver.

func (HebrewDate) String

func (d HebrewDate) String() string

type IslamicDate

type IslamicDate struct {
	Year  float64
	Month float64
	Day   float64
}

Islamic date

func IslamicFromAbsolute

func IslamicFromAbsolute(absoluteDate float64) IslamicDate

IslamicFromAbsolute computes the Islamic date corresponding to a given absolute date.

func (IslamicDate) Date

func (d IslamicDate) Date() Date

Date() creates a Date from its receiver.

func (IslamicDate) String

func (d IslamicDate) String() string

type IsoDate

type IsoDate struct {
	Year float64
	Week float64
	Day  float64
}

ISO date

func IsoFromAbsolute

func IsoFromAbsolute(absoluteDate float64) IsoDate

IsoFromAbsolute computes the IsoDate corresponding to a given absolute (fixed) date.

func (IsoDate) Date

func (d IsoDate) Date() Date

Date() creates a Date from its receiver.

func (IsoDate) String

func (d IsoDate) String() string

ISO calendar

type JulianDate

type JulianDate GregorianDate

Julian date

func JulianFromAbsolute

func JulianFromAbsolute(absoluteDate float64) JulianDate

JulianFromAbsolute computes the Julian date corresponding to a given absolute date.

func (JulianDate) Date

func (d JulianDate) Date() Date

Date() creates a Date from its receiver.

func (JulianDate) String

func (d JulianDate) String() string

type MayanHaabDate

type MayanHaabDate struct {
	Day   float64
	Month float64
}

Mayan Haab date type

var MayanHaabAtEpoch MayanHaabDate = MayanHaabDate{8, cumku}

MayanHaabAtEpoch denotes the haab date at long count 0.0.0.0.0.

func MayanHaabFromAbsolute

func MayanHaabFromAbsolute(absoluteDate float64) MayanHaabDate

MayanHaabFromAbsolute returns the Mayan haab date corresponding to a given absolute (fixed) date.

func (MayanHaabDate) Date

func (d MayanHaabDate) Date() Date

Date() creates a Date from its receiver.

func (MayanHaabDate) String

func (d MayanHaabDate) String() string

type MayanLongCount

type MayanLongCount struct {
	Baktun float64
	Katun  float64
	Tun    float64
	Uinal  float64
	Kin    float64
}

Mayan long count date type

func MayanLongCountFromAbsolute

func MayanLongCountFromAbsolute(absoluteDate float64) MayanLongCount

MayanLongCountFromAbsolute computes the Mayan long count corresponding to the given absolute date.

func (MayanLongCount) Date

func (d MayanLongCount) Date() Date

Date() creates a Date from its receiver.

func (MayanLongCount) String

func (d MayanLongCount) String() string

type MayanTzolkinDate

type MayanTzolkinDate struct {
	Number float64
	Name   float64
}

Mayan Tzolkin date type

var MayanTzolkinAtEpoch MayanTzolkinDate = MayanTzolkinDate{4, ahau}

MayanTzolkinAtEpoch denotes tha tzolkin date at long count 0.0.0.0.0.

func MayanTzolkinFromAbsolute

func MayanTzolkinFromAbsolute(absoluteDate float64) MayanTzolkinDate

MayanTzolkinFromAbsolute returns a Mayan tzolkin date corresponding to a given absolute (fixed) date.

func (MayanTzolkinDate) Date

func (d MayanTzolkinDate) Date() Date

Date() creates a Date from its receiver.

func (MayanTzolkinDate) String

func (d MayanTzolkinDate) String() string

type OldHinduLunarDate

type OldHinduLunarDate struct {
	Year      float64
	Month     float64
	LeapMonth bool
	Day       float64
}

Old Hindu lunar date type

func OldHinduLunarFromAbsolute

func OldHinduLunarFromAbsolute(absoluteDate float64) OldHinduLunarDate

OldHinduLunarFromAbsolute returns the Old Hindu lunar date corresponding to a given absolute (fixed) date.

func (OldHinduLunarDate) Date

func (d OldHinduLunarDate) Date() Date

Date() creates a Date from its receiver.

func (OldHinduLunarDate) String

func (d OldHinduLunarDate) String() string

type OldHinduSolarDate

type OldHinduSolarDate struct {
	Year  float64
	Month float64
	Day   float64
}

Old Hindu solar date type

func OldHinduSolarFromAbsolute

func OldHinduSolarFromAbsolute(absoluteDate float64) OldHinduSolarDate

OldHinduSolarFromAbsolute computes the Old Hindu solar date corresponding to a given absolute (fixed) date.

func (OldHinduSolarDate) Date

func (d OldHinduSolarDate) Date() Date

Date() creates a Date from its receiver.

func (OldHinduSolarDate) String

func (d OldHinduSolarDate) String() string

type Scanner

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

Scanner represents a lexical scanner.

func NewScanner

func NewScanner(reader io.Reader) *Scanner

NewScanner returns a new instance of Scanner.

func (*Scanner) Scan

func (s *Scanner) Scan() (tok token, str string)

Scan returns the next token and literal value.

Jump to

Keyboard shortcuts

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