Skip to content

Commit

Permalink
AddMonths()增加时区
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Jul 8, 2021
1 parent 5632285 commit b39784e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions traveler.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (c Carbon) SubQuarterNoOverflow() Carbon {

// AddMonths N月后
func (c Carbon) AddMonths(months int) Carbon {
c.Time = c.Time.AddDate(0, months, 0)
c.Time = c.Time.In(c.Loc).AddDate(0, months, 0)
return c
}

Expand Down Expand Up @@ -219,7 +219,7 @@ func (c Carbon) SubWeek() Carbon {

// AddDays N天后
func (c Carbon) AddDays(days int) Carbon {
c.Time = c.Time.AddDate(0, 0, days)
c.Time = c.Time.In(c.Loc).AddDate(0, 0, days)
return c
}

Expand Down

0 comments on commit b39784e

Please sign in to comment.