Skip to content

Commit

Permalink
return zero time on nil Time
Browse files Browse the repository at this point in the history
  • Loading branch information
rhino1998 committed Sep 23, 2024
1 parent 6c6e1a6 commit 34a31d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions configtype/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ func (d *Time) MarshalJSON() ([]byte, error) {
}

func (t *Time) Time(nowFunc NowFunc) time.Time {
if t == nil {
return time.Time{}
}

if !t.time.IsZero() {
return t.time
}
Expand Down

0 comments on commit 34a31d6

Please sign in to comment.