Skip to content

Commit 7c828e3

Browse files
committed
Judgment on whether adding testing time
1 parent 920fd87 commit 7c828e3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ func SetTestNow(carbon Carbon) Carbon {
88
// SetTestNow sets a test Carbon instance (real or mock) to be returned when a "now" instance is created.
99
func (c Carbon) SetTestNow(carbon Carbon) Carbon {
1010
c.testNow = carbon.TimestampNano()
11-
c.loc = carbon.loc
11+
if carbon.loc != nil {
12+
c.loc = carbon.loc
13+
}
1214
return c
1315
}
1416

0 commit comments

Comments
 (0)