NilIfZeroTime returns nil if t is nil or represents the zero time (0001-01-01...). Otherwise, it returns t unchanged.
(t *time.Time)
| 22 | // NilIfZeroTime returns nil if t is nil or represents the zero time (0001-01-01...). |
| 23 | // Otherwise, it returns t unchanged. |
| 24 | func NilIfZeroTime(t *time.Time) *time.Time { |
| 25 | if t == nil { |
| 26 | return nil |
| 27 | } |
| 28 | if t.IsZero() { |
| 29 | return nil |
| 30 | } |
| 31 | return t |
| 32 | } |
no outgoing calls