Skip to content

Commit 5d50dfb

Browse files
committed
fix Age method
1 parent 9e289e2 commit 5d50dfb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

difference.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func (c Carbon) DiffInYears(carbon ...Carbon) int64 {
1414
}
1515

1616
dy, dm, dd := end.Year()-start.Year(), end.Month()-start.Month(), end.Day()-start.Day()
17-
if dd < 0 || dm < 0 {
17+
if dm < 0 || (dm == 0 && dd < 0) {
1818
dy--
1919
}
2020
if dy < 0 && (dd != 0 || dm != 0) {

0 commit comments

Comments
 (0)