Skip to content

Commit 15d2fbf

Browse files
authored
Flip bar chart to newest to oldest (#2)
1 parent 9987475 commit 15d2fbf

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

deno.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"check": "deno fmt --check . && deno lint . && deno check",
55
"dev": "vite",
66
"build": "vite build",
7-
// todo(https://github.com/denoland/deno/pull/31718): remove this --allow-net
8-
"start": "deno serve -P --allow-net _fresh/server.js",
7+
"start": "deno serve -P _fresh/server.js",
98
"update": "deno run -A -r jsr:@fresh/update ."
109
},
1110
"test": {

routes/insights.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,14 @@ export class InsightsPageController {
374374
const oldestDate = allDates[0];
375375
const today = new Date().toISOString().split("T")[0];
376376

377-
// Generate all dates from oldest to today
377+
// Generate all dates from today to oldest (newest first, left to right)
378378
const dateRange: string[] = [];
379379
if (oldestDate) {
380-
const current = new Date(oldestDate + "T00:00:00");
381-
const end = new Date(today + "T00:00:00");
382-
while (current <= end) {
380+
const current = new Date(today + "T00:00:00");
381+
const end = new Date(oldestDate + "T00:00:00");
382+
while (current >= end) {
383383
dateRange.push(current.toISOString().split("T")[0]);
384-
current.setDate(current.getDate() + 1);
384+
current.setDate(current.getDate() - 1);
385385
}
386386
}
387387

0 commit comments

Comments
 (0)