Skip to content

Commit

Permalink
fix: show date and time in the index page
Browse files Browse the repository at this point in the history
  • Loading branch information
Kris3131 committed Sep 2, 2022
1 parent 273fc9d commit 162059e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions routes/modules/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 162059e

Please sign in to comment.