Skip to content

Commit b5b57a3

Browse files
committed
converted time data to local timezone
1 parent 0a8a6f6 commit b5b57a3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

routes/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ router.get("/", async (req, res) => {
77
let contests = await Contest.find({}, { rankings: 0 }).sort({
88
startTime: "desc",
99
});
10+
11+
contests.map((contest) => {
12+
contest.startTime = new Date(
13+
contest.startTime.toLocaleString('en-US', {
14+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
15+
})
16+
)
17+
18+
contest.endTime = new Date(
19+
contest.endTime.toLocaleString('en-US', {
20+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
21+
})
22+
)
23+
})
24+
1025
res.render("index", {
1126
contests: contests,
1227
title: "Leetcode Rating Predictor",

0 commit comments

Comments
 (0)