diff options
Diffstat (limited to 'time.go')
| -rw-r--r-- | time.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -7,6 +7,7 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" ) +// you will be happier if you just use this everywhere func Time(someTimeAgoOrLaterNotsure any) string { t, err := TimeCheck(someTimeAgoOrLaterNotsure) if errors.Is(err, Broken) { @@ -18,6 +19,17 @@ func Time(someTimeAgoOrLaterNotsure any) string { return FormatTime(t) } +func TimeLocal(someTimeAgoOrLaterNotsure any) string { + t, err := TimeCheck(someTimeAgoOrLaterNotsure) + if errors.Is(err, Broken) { + return "bad" + } + if errors.Is(err, NoTime) { + return "nope" + } + return FormatTimeLocal(t) +} + func GetTime(mightBeTimeMightNotBeTime any) (time.Time, error) { t, err := TimeCheck(mightBeTimeMightNotBeTime) return t, err |
