From b49686bb03cf36f68405ab15df4e97cd812523d4 Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 13 Mar 2023 20:24:34 +0800 Subject: [PATCH] chore: use padStart on month/date to keep a better output format --- lib/notion/getPageProperties.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/notion/getPageProperties.js b/lib/notion/getPageProperties.js index ea3171c3..0ba6a3bd 100644 --- a/lib/notion/getPageProperties.js +++ b/lib/notion/getPageProperties.js @@ -157,10 +157,10 @@ function generateCustomizeUrl(postProperties) { fullSlug += formatPostCreatedDate.getUTCFullYear() } else if (pattern === '%month%' && postProperties?.date?.start_date) { const formatPostCreatedDate = new Date(postProperties?.date?.start_date) - fullSlug += (formatPostCreatedDate.getUTCMonth() + 1) + fullSlug += String(formatPostCreatedDate.getUTCMonth() + 1).padStart(2, 0) } else if (pattern === '%day%' && postProperties?.date?.start_date) { const formatPostCreatedDate = new Date(postProperties?.date?.start_date) - fullSlug += formatPostCreatedDate.getUTCDate() + fullSlug += String(formatPostCreatedDate.getUTCDate()).padStart(2, 0) } else if (pattern === '%slug%') { fullSlug += (postProperties.slug ?? postProperties.id) } else if (!pattern.includes('%')) {