From fb78b5e704b0634f130de9096ed9da13621f971d Mon Sep 17 00:00:00 2001 From: lifeadventurer Date: Mon, 6 Nov 2023 23:20:24 +0800 Subject: [PATCH] fix: overflow bug --- fortune_generator/fortune.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fortune_generator/fortune.js b/fortune_generator/fortune.js index 4343303..4534f5d 100644 --- a/fortune_generator/fortune.js +++ b/fortune_generator/fortune.js @@ -26,13 +26,12 @@ const allBad = `諸事不 const d = new Date(); const date = d.getDate(); const day = d.getDay(); -console.log(day); const month = d.getMonth() + 1; const year = d.getFullYear(); const showMonth = `${chineseMonth[month - 1] + "月"}`; -const showDate = `${("0" + date).substr(-2)}`; -const showDay = `${"星期" + week[day]}`; +const showDate = `${("0" + date).substr(-2)}`; +const showDay = `${"星期" + week[day]}`; $('#month').html(showMonth); $('#date').html(showDate);