Update carbon.go

修复IsFirstDay、IsLastDay错误
This commit is contained in:
gouguoyin 2020-09-09 09:38:33 +08:00 committed by GitHub
parent bcec0e19f0
commit 6137e7b916
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -373,10 +373,10 @@ func (c *carbon) IsSunday() bool {
// IsFirstDay 是否月初
func (c *carbon) IsFirstDay() bool {
return c.Time.In(c.loc).Weekday().String() == "Sunday"
return c.time.In(c.loc).Day() == 1
}
// IsLastDay 是否是月末
func (c *carbon) IsLastDay() bool {
return c.Time.In(c.loc).Weekday().String() == "Sunday"
return c.time.In(c.loc).Format("2006-01-02 00:00:00") == c.LastDay()
}