Skip to content

Commit

Permalink
feat: sort upcoming slots in chronological order
Browse files Browse the repository at this point in the history
  • Loading branch information
c0repwn3r committed Nov 20, 2024
1 parent 7864935 commit f37fd77
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scheddy",
"version": "1.0.1",
"version": "1.0.2",
"type": "module",
"scripts": {
"dev": "vite dev",
Expand Down
14 changes: 14 additions & 0 deletions src/routes/(authed)/schedule/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,20 @@ function slottificate(
})
);
}

// sort chronologically
slots.sort((a, b) => {
const a_dt = Interval.fromISO(a.slot);
const b_dt = Interval.fromISO(b.slot);
if (a_dt.start < b_dt.start) {
return -1;
} else if (a_dt.start > b_dt.start) {
return 1;
} else {
return 0;
}
})

slotData[typ.id] = slots;
}

Expand Down

0 comments on commit f37fd77

Please sign in to comment.