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).