mirror of
https://gitee.com/dromara/carbon.git
synced 2024-12-01 19:58:07 +08:00
优化 DiffInMonths 方法
This commit is contained in:
parent
47e15d293c
commit
9d0f6e2567
@ -284,7 +284,7 @@ func getDiffInMonths(start, end Carbon, months int64) int64 {
|
||||
next := start.AddDays(start.DaysInMonth())
|
||||
days := next.DiffInDays(end)
|
||||
seconds := next.DiffInSeconds(end)
|
||||
if days < 0 || days == 0 && seconds < 0 {
|
||||
if days < 0 || (days == 0 && seconds < 0) {
|
||||
return months
|
||||
}
|
||||
months += 1
|
||||
|
Loading…
Reference in New Issue
Block a user