aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-02-07 02:36:13 -0800
committerFuwn <[email protected]>2024-02-07 02:36:13 -0800
commit3f59a41001dca8a0a4540f3ce67a4ac70c5ef683 (patch)
tree27d75c22e643b4c23b310225de5fc64b328c2bb3 /src
parentfeat(hololive): show ended tag (diff)
downloaddue.moe-3f59a41001dca8a0a4540f3ce67a4ac70c5ef683.tar.xz
due.moe-3f59a41001dca8a0a4540f3ce67a4ac70c5ef683.zip
feat(hololive): sort live, upcoming, ended
Diffstat (limited to 'src')
-rw-r--r--src/routes/hololive/+page.svelte16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/routes/hololive/+page.svelte b/src/routes/hololive/+page.svelte
index 4600dca0..26fb7537 100644
--- a/src/routes/hololive/+page.svelte
+++ b/src/routes/hololive/+page.svelte
@@ -58,11 +58,21 @@
return time.getTime() > Date.now() - 12 * 60 * 60 * 1000 || time.getTime() > Date.now() || live.streaming;
})
.sort((a, b) => {
- if (a.streaming && !b.streaming) return -1;
+ if (a.streaming && !b.streaming) {
+ return -1;
+ } else if (!a.streaming && b.streaming) {
+ return 1;
+ }
- if (!a.streaming && b.streaming) return 1;
+ const aTime = new Date(a.time).getTime();
- return new Date(a.time).getTime() - new Date(b.time).getTime();
+ if (aTime < Date.now() && new Date(b.time).getTime() > Date.now()) {
+ return 1;
+ } else if (aTime > Date.now() && new Date(b.time).getTime() < Date.now()) {
+ return -1;
+ }
+
+ return aTime - new Date(b.time).getTime();
}) as live}
<div class="stream card">
<p>