Skip to content

Commit

Permalink
fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
godcong committed Apr 6, 2020
1 parent 3a0339d commit 3e6cb0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lunar.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ func (lunar *Lunar) shiZhu() string {

//riZhu 日柱
func (lunar *Lunar) riZhu() string {
if lunar.Hour() >= 23 {
return StemBranchDay(lunar.Year(), int(lunar.Month()), lunar.Day()+1)
}
return StemBranchDay(lunar.Year(), int(lunar.Month()), lunar.Day())
}

Expand Down
3 changes: 2 additions & 1 deletion lunar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func TestLunar_EightCharacter(t *testing.T) {
//output 己 亥 甲 戌 庚 子 丁 丑
log.Println(chronos.New("2019/10/30 01:30").Lunar().EightCharacter())
//output 己 亥 甲 戌 庚 子 丙 子
log.Println(chronos.New("2019/10/30 23:30").Lunar().EightCharacter())
log.Println(chronos.New("2019/10/30 23:00").Lunar().EightCharacter())
log.Println(chronos.New("2019/10/31 00:30").Lunar().EightCharacter())

}

0 comments on commit 3e6cb0e

Please sign in to comment.