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,