Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change type of timestamp #1131

Merged
merged 1 commit into from Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions block_rich_text.go
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
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