Skip to content

Commit

Permalink
v2.1.3 optimize coding
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Apr 24, 2022
1 parent 339253d commit 8490da7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions calendar.lunar.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,11 @@ type lunar struct {
// 将公历转为农历
func (c Carbon) Lunar() (l lunar) {
l.isInvalid, l.isLeapMonth = false, false
if c.Error != nil {
if c.IsInvalid() {
l.Error = c.Error
l.isInvalid = true
return
}
if c.IsZero() {
l.isInvalid = true
return
}
// leapMonths:闰月总数,daysOfYear:年天数,daysOfMonth:月天数,leapMonth:闰月月份
daysInYear, daysInMonth, leapMonth := 365, 30, 0
// 有效范围检验
Expand Down

0 comments on commit 8490da7

Please sign in to comment.