Skip to content

Commit

Permalink
update: 公開時刻の対応
Browse files Browse the repository at this point in the history
  • Loading branch information
PigeonsHouse committed Dec 6, 2023
1 parent 035516f commit 206e717
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions utils/toybox.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ export function formatToybox(blog) {
},
}
})
const createdAt = blog.published_at
? new Date(blog.created_at) < new Date(blog.published_at)
? blog.published_at
: blog.created_at
: blog.created_at
const updatedAt = blog.published_at
? new Date(blog.updated_at) < new Date(blog.published_at)
? blog.published_at
: blog.updated_at
: blog.updated_at

return {
fields: {
body: blog.body_text,
Expand Down Expand Up @@ -42,8 +53,8 @@ export function formatToybox(blog) {
},
sys: {
id: blog.id,
createdAt: blog.created_at,
updatedAt: blog.updated_at,
createdAt,
updatedAt,
},
}
}

0 comments on commit 206e717

Please sign in to comment.