Skip to content

Commit

Permalink
fix: change type of timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
yokishava committed Nov 22, 2022
1 parent c99b47b commit 0040ead
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions block_rich_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}

Expand Down
3 changes: 2 additions & 1 deletion block_rich_text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0040ead

Please sign in to comment.