aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/AniList/activity.ts2
-rw-r--r--src/lib/AniList/wrapped.ts10
-rw-r--r--src/lib/Tools/Wrapped.svelte12
3 files changed, 14 insertions, 10 deletions
diff --git a/src/lib/AniList/activity.ts b/src/lib/AniList/activity.ts
index 6c8deca7..01c1010b 100644
--- a/src/lib/AniList/activity.ts
+++ b/src/lib/AniList/activity.ts
@@ -128,7 +128,7 @@ const activitiesPage = async (
pageInfo { hasNextPage }
activities(userId: ${userIdentity.id}, createdAt_greater: ${Math.floor(
new Date(year, 0, 1).getTime() / 1000
- )}, createdAt_lesser: ${Math.floor(new Date(year, 6, 1).getTime() / 1000)}) {
+ )}, createdAt_lesser: ${Math.floor(new Date(year, 7, 1).getTime() / 1000)}) {
... on TextActivity { createdAt }
... on ListActivity { createdAt }
... on MessageActivity { createdAt }
diff --git a/src/lib/AniList/wrapped.ts b/src/lib/AniList/wrapped.ts
index 00ae0acc..6730f2ea 100644
--- a/src/lib/AniList/wrapped.ts
+++ b/src/lib/AniList/wrapped.ts
@@ -83,7 +83,7 @@ const profileActivities = async (
const pages = [];
let page = 1;
let response = await get(page);
- const yearInSeconds = 31556952;
+ const beginningOfYear = new Date(now).setMonth(0, 1) / 1000;
pages.push(response['data']['Page']['activities']);
@@ -100,16 +100,16 @@ const profileActivities = async (
.filter(
(activity) =>
activity.type == 'TEXT' &&
- activity.createdAt > Math.floor(now / 1000) - yearInSeconds &&
- activity.createdAt < Math.floor(now / 1000)
+ activity.createdAt > beginningOfYear &&
+ activity.createdAt < now / 1000
).length,
messageCount: pages
.flat()
.filter(
(activity) =>
activity.type == 'MESSAGE' &&
- activity.createdAt > Math.floor(now / 1000) - yearInSeconds &&
- activity.createdAt < Math.floor(now / 1000)
+ activity.createdAt > beginningOfYear &&
+ activity.createdAt < now / 1000
).length
};
};
diff --git a/src/lib/Tools/Wrapped.svelte b/src/lib/Tools/Wrapped.svelte
index 8f29b668..a7bbdccf 100644
--- a/src/lib/Tools/Wrapped.svelte
+++ b/src/lib/Tools/Wrapped.svelte
@@ -482,7 +482,7 @@
{#if currentUserIdentity.id === -2}
Please log in to view this page.
{:else if currentUserIdentity.id !== -1}
- {#await currentYear !== new Date(Date.now()).getFullYear() || useFullActivityHistory ? fullActivityHistory(user, currentUserIdentity, currentYear) : getActivityHistory(currentUserIdentity)}
+ {#await currentYear !== new Date(Date.now()).getFullYear() || useFullActivityHistory || new Date().getMonth() <= 6 ? fullActivityHistory(user, currentUserIdentity, currentYear) : getActivityHistory(currentUserIdentity)}
{@html nbsp(`Loading${useFullActivityHistory ? ' full-year' : ''} activity history ...`)}
{:then activities}
{#await wrapped(user, currentUserIdentity, currentYear)}
@@ -524,7 +524,11 @@
Messages: {wrapped.activities.messageCount}
</div>
<div>
- Days Active: {activities.length}/{useFullActivityHistory ? 365 : 189}
+ Days Active: {#if currentYear !== new Date(Date.now()).getFullYear()}
+ ?/365
+ {:else}
+ {activities.length}/{useFullActivityHistory ? 365 : 189}
+ {/if}
</div>
</div>
</div>
@@ -602,7 +606,7 @@
{/each}
{:else}
<li>
- <p>(⌣_⌣”)</p>
+ <p style="opacity: 50%;">(⌣_⌣”)</p>
</li>
{/if}
</ol>
@@ -645,7 +649,7 @@
{/each}
{:else}
<li>
- <p>(⌣_⌣”)</p>
+ <p style="opacity: 50%;">(⌣_⌣”)</p>
</li>
{/if}
</ol>