From 2261033611dc06d5ab76bba6c88035d66918a1d8 Mon Sep 17 00:00:00 2001 From: lifeadventurer Date: Fri, 21 Jun 2024 16:54:06 +0800 Subject: [PATCH] Refactor: Replace substr with slice as substr is deprecated --- fortune_generator/js/fortune.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortune_generator/js/fortune.js b/fortune_generator/js/fortune.js index 01673aa..7432e72 100644 --- a/fortune_generator/js/fortune.js +++ b/fortune_generator/js/fortune.js @@ -94,7 +94,7 @@ async function init_page() { // show date before button pressed const showMonth = `${chineseMonth[month - 1] + "月"}`; - const showDate = `${("0" + date).substr(-2)}`; + const showDate = `${("0" + date).slice(-2)}`; const showDay = `${"星期" + week[day]}`; $('#month').html(showMonth);