Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bicstone committed Nov 3, 2024
1 parent c3c3ebe commit 6dd5f0f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,13 @@ export const createSchemaCustomization: GatsbyNode["createSchemaCustomization"]
*/
export const onCreateNode: GatsbyNode["onCreateNode"] = ({ node, actions }) => {
const { createNodeField } = actions;
const date = node.date ?? (node.frontmatter as Record<string, unknown>).date;
const date =
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- date is nullable
node?.date ?? (node?.frontmatter as Record<string, unknown>)?.date;

const endDate =
node.endDate ?? (node.frontmatter as Record<string, unknown>).endDate;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- endDate is nullable
node?.endDate ?? (node?.frontmatter as Record<string, unknown>)?.endDate;

if (typeof date === "string" || date instanceof Date) {
const dateYear = formatInTimeZone(date, "Asia/Tokyo", "yyyy");
Expand Down

0 comments on commit 6dd5f0f

Please sign in to comment.