From 162059e5aa8fc9651658d2ec1e85ddc640c711de Mon Sep 17 00:00:00 2001 From: Kris Date: Fri, 2 Sep 2022 22:46:15 +0800 Subject: [PATCH] fix: show date and time in the index page --- routes/modules/home.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/modules/home.js b/routes/modules/home.js index 5d4ca3e..2a7a1fd 100644 --- a/routes/modules/home.js +++ b/routes/modules/home.js @@ -7,15 +7,15 @@ routes.get('/', (req, res) => { const sortList = ['amount', '-amount', 'category', 'time'] const sortOption = sortList.includes(req.query.sort) ? req.query.sort : 'time' const userId = req.user._id - let totalAmount = 0 let icon = '' - + let totalAmount = 0 Record.find({ userId }) .lean() .sort(sortOption) .then((record) => { record.forEach((item) => { totalAmount = totalAmount + item.amount + item.date = item.date.toLocaleString('zh-tw') Category.findById(item.categoryId) .then((category) => { return (icon = category.icon)