From 0040eadde5daa78554fa11e28822332a445929e7 Mon Sep 17 00:00:00 2001 From: yokishava Date: Tue, 22 Nov 2022 13:07:41 +0900 Subject: [PATCH] fix: change type of timestamp --- block_rich_text.go | 6 +++--- block_rich_text_test.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/block_rich_text.go b/block_rich_text.go index 281db213a..555a61989 100644 --- a/block_rich_text.go +++ b/block_rich_text.go @@ -327,17 +327,17 @@ func NewRichTextSectionUserGroupElement(usergroupID string) *RichTextSectionUser type RichTextSectionDateElement struct { Type RichTextSectionElementType `json:"type"` - Timestamp string `json:"timestamp"` + Timestamp JSONTime `json:"timestamp"` } func (r RichTextSectionDateElement) RichTextSectionElementType() RichTextSectionElementType { return r.Type } -func NewRichTextSectionDateElement(timestamp string) *RichTextSectionDateElement { +func NewRichTextSectionDateElement(timestamp int64) *RichTextSectionDateElement { return &RichTextSectionDateElement{ Type: RTSEDate, - Timestamp: timestamp, + Timestamp: JSONTime(timestamp), } } diff --git a/block_rich_text_test.go b/block_rich_text_test.go index 4c889eba5..270dde94c 100644 --- a/block_rich_text_test.go +++ b/block_rich_text_test.go @@ -80,12 +80,13 @@ func TestRichTextSection_UnmarshalJSON(t *testing.T) { err error }{ { - []byte(`{"elements":[{"type":"unknown","value":10},{"type":"text","text":"hi"}]}`), + []byte(`{"elements":[{"type":"unknown","value":10},{"type":"text","text":"hi"},{"type":"date","timestamp":1636961629}]}`), RichTextSection{ Type: RTESection, Elements: []RichTextSectionElement{ &RichTextSectionUnknownElement{Type: RTSEUnknown, Raw: `{"type":"unknown","value":10}`}, &RichTextSectionTextElement{Type: RTSEText, Text: "hi"}, + &RichTextSectionDateElement{Type: RTSEDate, Timestamp: JSONTime(1636961629)}, }, }, nil,