From 8caad09446b24edc30a83831a44931e444ab218c Mon Sep 17 00:00:00 2001 From: Stanly Date: Mon, 7 Mar 2022 15:25:46 +0800 Subject: [PATCH] fix Date & Datetime --- types/timestamp.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/timestamp.go b/types/timestamp.go index f15c896..bfcd250 100644 --- a/types/timestamp.go +++ b/types/timestamp.go @@ -50,6 +50,9 @@ func (t Timestamp) Time() time.Time { // Date 回傳日期字串 func (t Timestamp) Date() string { + if t == 0 { + return "" + } return time. Unix(t.Int64(), 0). In(Local). @@ -58,6 +61,9 @@ func (t Timestamp) Date() string { // Datetime 回傳時間字串 func (t Timestamp) Datetime() string { + if t == 0 { + return "" + } return time. Unix(t.Int64(), 0). In(Local).