From d7ee602d7352943d12e8588623a364c1bf2214ed Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 26 Oct 2025 12:35:32 -0500 Subject: another case --- duration.go | 5 ++--- time.go | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/duration.go b/duration.go index ea25d47..3243bb4 100644 --- a/duration.go +++ b/duration.go @@ -32,14 +32,13 @@ func DurationCheck(maybeTime any) (time.Duration, error) { case time.Time: // If the type is time.Time, 'v' is now a time.Time variable. d = time.Since(v) + case *time.Time: + d = time.Since(*v) case time.Duration: - // If the type is time.Time, 'v' is now a time.Time variable. d = v case *time.Duration: - // If the type is time.Time, 'v' is now a time.Time variable. d = *v case string: - // The type is string, so 'v' is a string variable. // t, err = doTimeString(v) err = NewFeature case *timestamppb.Timestamp: diff --git a/time.go b/time.go index ca38233..48af980 100644 --- a/time.go +++ b/time.go @@ -34,6 +34,9 @@ func isUTC(t time.Time) bool { func TimeLocal(someTimeAgoOrLaterNotsure any) string { guess, t, err := TimeCheck(someTimeAgoOrLaterNotsure) + if t != nil { + return FormatTimeLocal(*t) + } if errors.Is(err, Broken) { if len(guess) > 0 { return fmt.Sprintf("%-15s", guess) -- cgit v1.2.3