From 0000d58be3ad150320edd41017b8a9ad6c705d1c Mon Sep 17 00:00:00 2001 From: lifeadventurer Date: Sat, 25 Nov 2023 17:24:25 +0800 Subject: [PATCH] fix: get rid of the time difference decimal --- fortune_generator/fortune.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortune_generator/fortune.js b/fortune_generator/fortune.js index 705aa9d..40af50a 100644 --- a/fortune_generator/fortune.js +++ b/fortune_generator/fortune.js @@ -54,7 +54,7 @@ function daysDiff(eventIndex){ const endDate = new Date(`${special_events[eventIndex].year}-${special_events[eventIndex].month}-${special_events[eventIndex].date}`); // calculate the difference in milliseconds and convert it to days - const timeDiff = (endDate - startDate) / (1000 * 60 * 60 * 24); + const timeDiff = Math.floor((endDate - startDate) / (1000 * 60 * 60 * 24)); return timeDiff; }