From 27dc31958bab49093cf705c14929700e3e1d85a6 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 1 Jan 2024 01:06:55 -0800 Subject: fix(wrapped): fix for next year --- src/lib/AniList/wrapped.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib/AniList/wrapped.ts') 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 }; }; -- cgit v1.2.3