From 827bf55c4442b0f7ca2e96e7454b9cb2a2b51dfd Mon Sep 17 00:00:00 2001 From: Stanly Date: Thu, 10 Dec 2020 06:13:48 +0800 Subject: [PATCH] Add timestamp after & afternow --- types/timestamp.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/timestamp.go b/types/timestamp.go index b7479ee..f15c896 100644 --- a/types/timestamp.go +++ b/types/timestamp.go @@ -73,3 +73,13 @@ func (t Timestamp) NowSub() time.Duration { func (t Timestamp) Sub(t2 time.Time) time.Duration { return t2.Sub(t.Time()) } + +// After 是否在指定時間後 +func (t Timestamp) After(t2 time.Time) bool { + return t.Time().After(t2) +} + +// AfterNow 是否在目前時間後 +func (t Timestamp) AfterNow() bool { + return t.After(time.Now()) +}