Documentation
¶
Overview ¶
Convert Gregorian date to Kollavarsham date and vice versa
Convert Gregorian date to Kollavarsham date and vice versa ¶
Convert Gregorian date to Kollavarsham date and vice versa ¶
Convert Gregorian date to Kollavarsham date and vice versa ¶
Convert Gregorian date to Kollavarsham date and vice versa ¶
Convert Gregorian date to Kollavarsham date and vice versa ¶
Convert Gregorian date to Kollavarsham date and vice versa ¶
Convert Gregorian date to Kollavarsham date and vice versa ¶
Convert Gregorian date to Kollavarsham date and vice versa ¶
Convert Gregorian date to Kollavarsham date and vice versa ¶
Convert Gregorian date to Kollavarsham date and vice versa ¶
Convert Gregorian date to Kollavarsham date and vice versa ¶
Convert Gregorian date to Kollavarsham date and vice versa
Index ¶
- func NewBaseDate_Override(b BaseDate, year *float64, month *float64, date *float64)
- func NewJulianDate_Override(j JulianDate, year *float64, month *float64, day *float64)
- func NewKollavarshamDate_Override(k KollavarshamDate, year *float64, month *float64, day *float64)
- func NewKollavarsham_Override(k Kollavarsham, options *Settings)
- func NewSakaDate_Override(s SakaDate, year *float64, month *float64, tithi *float64, paksa *string)
- type BaseDate
- type JulianDate
- type Kollavarsham
- type KollavarshamDate
- type MasaName
- type Naksatra
- type SakaDate
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBaseDate_Override ¶
func NewJulianDate_Override ¶
func NewJulianDate_Override(j JulianDate, year *float64, month *float64, day *float64)
func NewKollavarshamDate_Override ¶
func NewKollavarshamDate_Override(k KollavarshamDate, year *float64, month *float64, day *float64)
func NewKollavarsham_Override ¶
func NewKollavarsham_Override(k Kollavarsham, options *Settings)
Types ¶
type BaseDate ¶
type BaseDate interface {
// The `Ahargana` corresponding to this instance of the date. **Set separately after an instance is created**.
//
// In Sanskrit `ahoratra` means one full day and `gana` means count.
// Hence, the Ahargana on any given day stands for the number of lunar days that have elapsed starting from an epoch.
//
// _Source_: http://cs.annauniv.edu/insight/Reading%20Materials/astro/sharptime/ahargana.htm
Ahargana() *float64
SetAhargana(val *float64)
// The date corresponding to this instance of the date.
Date() *float64
SetDate(val *float64)
// The gregorian date corresponding to this instance of the date.
//
// **Set separately after an instance is created**.
GregorianDate() *time.Time
SetGregorianDate(val *time.Time)
// The `Julian Day` corresponding to this instance of the date.
//
// **Set separately after an instance is created**
// Julian day is the continuous count of days since the beginning of the Julian Period used primarily by astronomers.
//
// _Source_: https://en.wikipedia.org/wiki/Julian_day
JulianDay() *float64
SetJulianDay(val *float64)
// Returns the weekday (in Malayalam) for the current instance of date.
MlWeekdayName() *string
// The month corresponding to this instance of the date.
Month() *float64
SetMonth(val *float64)
Naksatra() *Naksatra
SetNaksatra(val *Naksatra)
// The `Saura Divasa` (Solar Calendar Day) for this instance of the date.
//
// **Set separately after an instance is created**.
SauraDivasa() *float64
SetSauraDivasa(val *float64)
// The `Saura Masa` (Solar Calendar Month) for this instance of the date.
//
// **Set separately after an instance is created**.
SauraMasa() *float64
SetSauraMasa(val *float64)
// Returns the Saura Masa name for the current instance of date.
SauraMasaName() *string
// Returns the weekday (in English) for the current instance of date.
WeekdayName() *string
// The year corresponding to this instance of the date.
Year() *float64
SetYear(val *float64)
// Converts the Date to a nicely formatted string with year, month and date.
ToString() *string
}
Serves as the base class for both the {@link JulianDate} and {@link KollavarshamDate} classes.
**INTERNAL/PRIVATE**.
type JulianDate ¶
type JulianDate interface {
BaseDate
// The `Ahargana` corresponding to this instance of the date. **Set separately after an instance is created**.
//
// In Sanskrit `ahoratra` means one full day and `gana` means count.
// Hence, the Ahargana on any given day stands for the number of lunar days that have elapsed starting from an epoch.
//
// _Source_: http://cs.annauniv.edu/insight/Reading%20Materials/astro/sharptime/ahargana.htm
Ahargana() *float64
SetAhargana(val *float64)
// The date corresponding to this instance of the date.
Date() *float64
SetDate(val *float64)
// The gregorian date corresponding to this instance of the date.
//
// **Set separately after an instance is created**.
GregorianDate() *time.Time
SetGregorianDate(val *time.Time)
// The `Julian Day` corresponding to this instance of the date.
//
// **Set separately after an instance is created**
// Julian day is the continuous count of days since the beginning of the Julian Period used primarily by astronomers.
//
// _Source_: https://en.wikipedia.org/wiki/Julian_day
JulianDay() *float64
SetJulianDay(val *float64)
// Returns the weekday (in Malayalam) for the current instance of date.
MlWeekdayName() *string
// The month corresponding to this instance of the date.
Month() *float64
SetMonth(val *float64)
Naksatra() *Naksatra
SetNaksatra(val *Naksatra)
// The `Saura Divasa` (Solar Calendar Day) for this instance of the date.
//
// **Set separately after an instance is created**.
SauraDivasa() *float64
SetSauraDivasa(val *float64)
// The `Saura Masa` (Solar Calendar Month) for this instance of the date.
//
// **Set separately after an instance is created**.
SauraMasa() *float64
SetSauraMasa(val *float64)
// Returns the Saura Masa name for the current instance of date.
SauraMasaName() *string
// Returns the weekday (in English) for the current instance of date.
WeekdayName() *string
// The year corresponding to this instance of the date.
Year() *float64
SetYear(val *float64)
// Converts the Date to a nicely formatted string with year, month and date.
ToString() *string
}
Represents a Julian date's year, month and day `toGregorianDateFromSaka` method of the {@link Kollavarsham} class returns an instance of this type for dates older than `1st January 1583 AD`.
**INTERNAL/PRIVATE**.
func NewJulianDate ¶
func NewJulianDate(year *float64, month *float64, day *float64) JulianDate
type Kollavarsham ¶
type Kollavarsham interface {
Settings() *Settings
SetSettings(val *Settings)
// Converts a Gregorian date to the equivalent Kollavarsham date, respecting the current configuration.
//
// Returns: Converted date.
//
// Example:
// const Kollavarsham = require('Kollavarsham');
// const kollavarsham = new Kollavarsham();
// let today = kollavarsham.fromGregorianDate(new Date(1979, 4, 22));
//
FromGregorianDate(date *time.Time) KollavarshamDate
// Converts a Kollavarsham date (an instance of {@link kollavarshamDate}) to its equivalent Gregorian date, respecting the current configuration.
//
// This method Will return {@link JulianDate} object for any date before 1st January 1583 AD and
// [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) objects for later dates.
//
// **This API has not been implemented yet**.
//
// Returns: Converted date.
ToGregorianDate(date KollavarshamDate) *time.Time
// Converts a Saka date (an instance of {@link sakaDate}) to its equivalent Gregorian date, respecting the current configuration.
//
// This method Will return {@link JulianDate} object for any date before 1st January 1583 AD and
// [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) objects for later dates.
//
// Returns: Converted date.
ToGregorianDateFromSaka(sakaDate SakaDate) KollavarshamDate
}
The Kollavarsham class implements all the public APIs of the library.
Create a new instance of this class, passing in the relevant options and call methods on the instance.
Example:
const Kollavarsham = require('kollavarsham');
const options = {
system: 'SuryaSiddhanta',
latitude: 10,
longitude: 76.2
};
const kollavarsham = new Kollavarsham(options);
let todayInMalayalamEra = kollavarsham.fromGregorianDate(new Date());
let today = kollavarsham.toGregorianDate(todayInMalayalamEra); // Not implemented yet
func NewKollavarsham ¶
func NewKollavarsham(options *Settings) Kollavarsham
type KollavarshamDate ¶
type KollavarshamDate interface {
BaseDate
// The `Ahargana` corresponding to this instance of the date. **Set separately after an instance is created**.
//
// In Sanskrit `ahoratra` means one full day and `gana` means count.
// Hence, the Ahargana on any given day stands for the number of lunar days that have elapsed starting from an epoch.
//
// _Source_: http://cs.annauniv.edu/insight/Reading%20Materials/astro/sharptime/ahargana.htm
Ahargana() *float64
SetAhargana(val *float64)
// The date corresponding to this instance of the date.
Date() *float64
SetDate(val *float64)
// The gregorian date corresponding to this instance of the date.
//
// **Set separately after an instance is created**.
GregorianDate() *time.Time
SetGregorianDate(val *time.Time)
// The `Julian Day` corresponding to this instance of the date.
//
// **Set separately after an instance is created**
// Julian day is the continuous count of days since the beginning of the Julian Period used primarily by astronomers.
//
// _Source_: https://en.wikipedia.org/wiki/Julian_day
JulianDay() *float64
SetJulianDay(val *float64)
// Returns the Kollavarsham month name (in English) for this instance of date.
MasaName() *string
// Returns the Kollavarsham month name (in Malayalam) for this instance of date.
MlMasaName() *string
// Returns the Kollavarsham Naksatra name (in Malayalam) for this instance of date.
MlNaksatraName() *string
// Returns the weekday (in Malayalam) for the current instance of date.
MlWeekdayName() *string
// The month corresponding to this instance of the date.
Month() *float64
SetMonth(val *float64)
Naksatra() *Naksatra
SetNaksatra(val *Naksatra)
// Returns the Kollavarsham Naksatra name (in English) for this instance date.
NaksatraName() *string
SakaDate() SakaDate
SetSakaDate(val SakaDate)
// The `Saura Divasa` (Solar Calendar Day) for this instance of the date.
//
// **Set separately after an instance is created**.
SauraDivasa() *float64
SetSauraDivasa(val *float64)
// The `Saura Masa` (Solar Calendar Month) for this instance of the date.
//
// **Set separately after an instance is created**.
SauraMasa() *float64
SetSauraMasa(val *float64)
// Returns the Saura Masa name for the current instance of date.
SauraMasaName() *string
// Returns the weekday (in English) for the current instance of date.
WeekdayName() *string
// The year corresponding to this instance of the date.
Year() *float64
SetYear(val *float64)
// Converts the Date to a nicely formatted string with year, month and date.
ToString() *string
}
Represents a Kollavarsham date's year, month and date.
func NewKollavarshamDate ¶
func NewKollavarshamDate(year *float64, month *float64, day *float64) KollavarshamDate
type MasaName ¶
type MasaName struct {
EnMalayalam *string `field:"required" json:"enMalayalam" yaml:"enMalayalam"`
MlMalayalam *string `field:"required" json:"mlMalayalam" yaml:"mlMalayalam"`
Saka *string `field:"required" json:"saka" yaml:"saka"`
Saura *string `field:"required" json:"saura" yaml:"saura"`
}
func BaseDate_GetMasaName ¶
Returns the month names object that has Saka, Saura and Kollavarsham (English & Malayalam) month names for the specified index `masaNumber`.
func JulianDate_GetMasaName ¶
Returns the month names object that has Saka, Saura and Kollavarsham (English & Malayalam) month names for the specified index `masaNumber`.
func KollavarshamDate_GetMasaName ¶
Returns the month names object that has Saka, Saura and Kollavarsham (English & Malayalam) month names for the specified index `masaNumber`.
func SakaDate_GetMasaName ¶
Returns the month names object that has Saka, Saura and Kollavarsham (English & Malayalam) month names for the specified index `masaNumber`.
type SakaDate ¶
type SakaDate interface {
BaseDate
// The Adhimasa (`Adhika Masa`) prefix corresponding to this instance of the date.
//
// **Set separately after an instance is created**.
Adhimasa() *string
SetAdhimasa(val *string)
// The `Ahargana` corresponding to this instance of the date. **Set separately after an instance is created**.
//
// In Sanskrit `ahoratra` means one full day and `gana` means count.
// Hence, the Ahargana on any given day stands for the number of lunar days that have elapsed starting from an epoch.
//
// _Source_: http://cs.annauniv.edu/insight/Reading%20Materials/astro/sharptime/ahargana.htm
Ahargana() *float64
SetAhargana(val *float64)
// The date corresponding to this instance of the date.
Date() *float64
SetDate(val *float64)
// The fractional `Tithi`corresponding to this instance of the date.
//
// **Set separately after an instance is created**.
FractionalTithi() *float64
SetFractionalTithi(val *float64)
// The gregorian date corresponding to this instance of the date.
//
// **Set separately after an instance is created**.
GregorianDate() *time.Time
SetGregorianDate(val *time.Time)
// The `Julian Day` corresponding to this instance of the date.
//
// **Set separately after an instance is created**
// Julian day is the continuous count of days since the beginning of the Julian Period used primarily by astronomers.
//
// _Source_: https://en.wikipedia.org/wiki/Julian_day
JulianDay() *float64
SetJulianDay(val *float64)
// The Kali year corresponding to this instance of the date.
//
// **Set separately after an instance is created**.
KaliYear() *float64
SetKaliYear(val *float64)
// Returns the month name for this instance of SakaDate.
MasaName() *string
// Returns the weekday (in Malayalam) for the current instance of date.
MlWeekdayName() *string
// The month corresponding to this instance of the date.
Month() *float64
SetMonth(val *float64)
Naksatra() *Naksatra
SetNaksatra(val *Naksatra)
// Returns the Saka Naksatra name for this instance of SakaDate.
NaksatraName() *string
// The original ahargana passed in to the celestial calculations (TODO: Not sure why we need this!?).
OriginalAhargana() *float64
SetOriginalAhargana(val *float64)
// The Paksha/Paksa corresponding to this instance of the date.
//
// Paksha (or pakṣa: Sanskrit: पक्ष), refers to a fortnight or a lunar phase in a month of the Hindu lunar calendar.
//
// _Source_: https://en.wikipedia.org/wiki/Paksha
Paksa() *string
SetPaksa(val *string)
// Returns the Saka year on this instance of SakaDate (same as the underlyiung `year` property from the {@link BaseDate} class).
SakaYear() *float64
// The `Saura Divasa` (Solar Calendar Day) for this instance of the date.
//
// **Set separately after an instance is created**.
SauraDivasa() *float64
SetSauraDivasa(val *float64)
// The `Saura Masa` (Solar Calendar Month) for this instance of the date.
//
// **Set separately after an instance is created**.
SauraMasa() *float64
SetSauraMasa(val *float64)
// Returns the Saura Masa name for the current instance of date.
SauraMasaName() *string
// The hour part from the sunrise time for this date.
//
// **Set separately after an instance is created**.
SunriseHour() *float64
SetSunriseHour(val *float64)
// The minute part from the sunrise time for this date.
//
// **Set separately after an instance is created**.
SunriseMinute() *float64
SetSunriseMinute(val *float64)
// Returns the Tithi on this instance of SakaDate (same as the underlyiung `date` property from the {@link BaseDate} class).
//
// In Vedic timekeeping, a tithi (also spelled thithi) is a lunar day, or the time it takes for the longitudinal angle between the Moon and the Sun to increase by 12°.
// Tithis begin at varying times of day and vary in duration from approximately 19 to approximately 26 hours.
//
// _Source_: https://en.wikipedia.org/wiki/Tithi
Tithi() *float64
// Returns the Vikrama year corresponding to the Saka year of this instance.
VikramaYear() *float64
// Returns the weekday (in English) for the current instance of date.
WeekdayName() *string
// The year corresponding to this instance of the date.
Year() *float64
SetYear(val *float64)
// Generates an instance of {@link KollavarshamDate} from this instance of SakaDate.
GenerateKollavarshamDate() KollavarshamDate
// Converts the Date to a nicely formatted string with year, month and date.
ToString() *string
}
Represents an Saka date's year, month and paksa and tithi.
Source Files
¶
- converter.go
- converter_BaseDate.go
- converter_BaseDate__runtime_type_checks.go
- converter_JulianDate.go
- converter_JulianDate__runtime_type_checks.go
- converter_Kollavarsham.go
- converter_KollavarshamDate.go
- converter_KollavarshamDate__runtime_type_checks.go
- converter_Kollavarsham__runtime_type_checks.go
- converter_MasaName.go
- converter_Naksatra.go
- converter_SakaDate.go
- converter_SakaDate__runtime_type_checks.go
- converter_Settings.go