lunar

package
v2.6.16 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package lunar is part of the carbon package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lunar

type Lunar struct {
	Error error
	// contains filtered or unexported fields
}

Lunar defines a Lunar struct.

func FromStdTime added in v2.6.2

func FromStdTime(t time.Time) *Lunar

FromStdTime creates a Lunar instance from standard time.Time.

func NewLunar added in v2.6.2

func NewLunar(year, month, day int, isLeapMonth bool) *Lunar

NewLunar returns a new Lunar instance.

func (*Lunar) Animal

func (l *Lunar) Animal() string

Animal gets lunar animal name like "猴".

func (*Lunar) Day

func (l *Lunar) Day() int

Day gets lunar day like 5.

func (*Lunar) Festival

func (l *Lunar) Festival() string

Festival gets lunar festival name like "春节".

func (*Lunar) IsDogYear

func (l *Lunar) IsDogYear() bool

IsDogYear reports whether is lunar year of Dog.

func (*Lunar) IsDragonYear

func (l *Lunar) IsDragonYear() bool

IsDragonYear reports whether is lunar year of Dragon.

func (*Lunar) IsGoatYear

func (l *Lunar) IsGoatYear() bool

IsGoatYear reports whether is lunar year of Goat.

func (*Lunar) IsHorseYear

func (l *Lunar) IsHorseYear() bool

IsHorseYear reports whether is lunar year of Horse.

func (*Lunar) IsLeapMonth

func (l *Lunar) IsLeapMonth() bool

IsLeapMonth reports whether is a lunar leap month.

func (*Lunar) IsLeapYear

func (l *Lunar) IsLeapYear() bool

IsLeapYear reports whether is a lunar leap year.

func (*Lunar) IsMonkeyYear

func (l *Lunar) IsMonkeyYear() bool

IsMonkeyYear reports whether is lunar year of Monkey.

func (*Lunar) IsOxYear

func (l *Lunar) IsOxYear() bool

IsOxYear reports whether is lunar year of Ox.

func (*Lunar) IsPigYear

func (l *Lunar) IsPigYear() bool

IsPigYear reports whether is lunar year of Pig.

func (*Lunar) IsRabbitYear

func (l *Lunar) IsRabbitYear() bool

IsRabbitYear reports whether is lunar year of Rabbit.

func (*Lunar) IsRatYear

func (l *Lunar) IsRatYear() bool

IsRatYear reports whether is lunar year of Rat.

func (*Lunar) IsRoosterYear

func (l *Lunar) IsRoosterYear() bool

IsRoosterYear reports whether is lunar year of Rooster.

func (*Lunar) IsSnakeYear

func (l *Lunar) IsSnakeYear() bool

IsSnakeYear reports whether is lunar year of Snake.

func (*Lunar) IsTigerYear

func (l *Lunar) IsTigerYear() bool

IsTigerYear reports whether is lunar year of Tiger.

func (*Lunar) IsValid added in v2.5.2

func (l *Lunar) IsValid() bool

IsValid reports whether is a valid lunar date.

func (*Lunar) LeapMonth

func (l *Lunar) LeapMonth() int

LeapMonth gets lunar leap month like 2.

func (*Lunar) Month

func (l *Lunar) Month() int

Month gets lunar month like 8.

func (*Lunar) String

func (l *Lunar) String() string

String implements "Stringer" interface for Lunar.

func (*Lunar) ToDateString

func (l *Lunar) ToDateString() string

ToDateString outputs a string in lunar date format like "二零二零年腊月初五". 获取农历日期字符串,如 "二零二零年腊月初五"

func (*Lunar) ToDayString

func (l *Lunar) ToDayString() (day string)

ToDayString outputs a string in lunar day format like "廿一".

func (*Lunar) ToGregorian

func (l *Lunar) ToGregorian(timezone ...string) *calendar.Gregorian

ToGregorian converts Lunar instance to Gregorian instance.

func (*Lunar) ToMonthString

func (l *Lunar) ToMonthString() (month string)

ToMonthString outputs a string in lunar month format like "正月".

func (*Lunar) ToWeekString

func (l *Lunar) ToWeekString() (month string)

ToWeekString outputs a string in week layout like "周一".

func (*Lunar) ToYearString

func (l *Lunar) ToYearString() (year string)

ToYearString outputs a string in lunar year format like "二零二零".

func (*Lunar) Year

func (l *Lunar) Year() int

Year gets lunar year like 2020.

Jump to

Keyboard shortcuts

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