Documentation
¶
Overview ¶
Package lunar is part of the carbon package.
Index ¶
- Variables
- type Lunar
- func (l *Lunar) Animal() string
- func (l *Lunar) Day() int
- func (l *Lunar) Festival() string
- func (l *Lunar) IsDogYear() bool
- func (l *Lunar) IsDragonYear() bool
- func (l *Lunar) IsGoatYear() bool
- func (l *Lunar) IsHorseYear() bool
- func (l *Lunar) IsLeapMonth() bool
- func (l *Lunar) IsLeapYear() bool
- func (l *Lunar) IsMonkeyYear() bool
- func (l *Lunar) IsOxYear() bool
- func (l *Lunar) IsPigYear() bool
- func (l *Lunar) IsRabbitYear() bool
- func (l *Lunar) IsRatYear() bool
- func (l *Lunar) IsRoosterYear() bool
- func (l *Lunar) IsSnakeYear() bool
- func (l *Lunar) IsTigerYear() bool
- func (l *Lunar) IsValid() bool
- func (l *Lunar) LeapMonth() int
- func (l *Lunar) Month() int
- func (l *Lunar) String() string
- func (l *Lunar) ToDateString() string
- func (l *Lunar) ToDayString() (day string)
- func (l *Lunar) ToGregorian(timezone ...string) *calendar.Gregorian
- func (l *Lunar) ToMonthString() (month string)
- func (l *Lunar) ToWeekString() (month string)
- func (l *Lunar) ToYearString() (year string)
- func (l *Lunar) Year() int
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidLunar = func() error { return fmt.Errorf("invalid lunar date, please make sure the lunar date is valid") }
ErrInvalidLunar returns a invalid lunar date. 无效的农历日期错误
Functions ¶
This section is empty.
Types ¶
type Lunar ¶
type Lunar struct { Error error // contains filtered or unexported fields }
Lunar defines a Lunar struct. 定义 Lunar 结构体
func FromStdTime ¶ added in v2.6.2
FromStdTime creates a Lunar instance from standard time.Time. 从标准 time.Time 创建 Lunar 实例
func MaxValue ¶ added in v2.5.2
func MaxValue() *Lunar
MaxValue returns a Lunar instance for the greatest supported date. 返回 Carbon 的最大值
func MinValue ¶ added in v2.5.2
func MinValue() *Lunar
MinValue returns a Lunar instance for the lowest supported date. 返回 Lunar 的最小值
func (*Lunar) IsDragonYear ¶
IsDragonYear reports whether is lunar year of Dragon. 是否是龙年
func (*Lunar) IsGoatYear ¶
IsGoatYear reports whether is lunar year of Goat. 是否是羊年
func (*Lunar) IsHorseYear ¶
IsHorseYear reports whether is lunar year of Horse. 是否是马年
func (*Lunar) IsLeapMonth ¶
IsLeapMonth reports whether is a lunar leap month. 是否是农历闰月
func (*Lunar) IsLeapYear ¶
IsLeapYear reports whether is a lunar leap year. 是否是农历闰年
func (*Lunar) IsMonkeyYear ¶
IsMonkeyYear reports whether is lunar year of Monkey. 是否是猴年
func (*Lunar) IsRabbitYear ¶
IsRabbitYear reports whether is lunar year of Rabbit. 是否是兔年
func (*Lunar) IsRoosterYear ¶
IsRoosterYear reports whether is lunar year of Rooster. 是否是鸡年
func (*Lunar) IsSnakeYear ¶
IsSnakeYear reports whether is lunar year of Snake. 是否是蛇年
func (*Lunar) IsTigerYear ¶
IsTigerYear reports whether is lunar year of Tiger. 是否是虎年
func (*Lunar) ToDateString ¶
ToDateString outputs a string in lunar date format like "二零二零年腊月初五". 获取农历日期字符串,如 "二零二零年腊月初五"
func (*Lunar) ToDayString ¶
ToDayString outputs a string in lunar day format like "廿一". 获取农历日字符串,如 "廿一"
func (*Lunar) ToGregorian ¶
ToGregorian converts Lunar instance to Gregorian instance. 将 Lunar 实例转化为 Gregorian 实例
func (*Lunar) ToMonthString ¶
ToMonthString outputs a string in lunar month format like "正月". 获取农历月份字符串,如 "正月"
func (*Lunar) ToWeekString ¶
ToWeekString outputs a string in week layout like "周一". 输出完整农历星期字符串,如 "周一"
func (*Lunar) ToYearString ¶
ToYearString outputs a string in lunar year format like "二零二零". 获取农历年份字符串,如 "二零二零"