From 1387b371a486fe048888396a294e7ce61ff02902 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 17 Sep 2023 21:03:57 -0700 Subject: feat(anime): bold if releasing soon --- src/lib/Media/anime.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/Media/anime.ts b/src/lib/Media/anime.ts index 0eed9121..19fa693a 100644 --- a/src/lib/Media/anime.ts +++ b/src/lib/Media/anime.ts @@ -29,6 +29,7 @@ export const airingTime = (anime: Media, upcoming = false) => { if (untilAiring !== undefined) { let minutes = untilAiring / 60; + let few = true; if (minutes >= 30) { let hours = minutes / 60; @@ -36,6 +37,8 @@ export const airingTime = (anime: Media, upcoming = false) => { if (hours >= 24) { let weeks = Math.floor(Math.floor(hours / 24) / 7); + few = false; + if (weeks >= 1) { weeks = Math.round(weeks); @@ -59,7 +62,9 @@ export const airingTime = (anime: Media, upcoming = false) => { if (upcoming) { return `${anime.nextAiringEpisode?.episode}${totalEpisodes(anime)} in ${timeFrame}`; } else { - return `${anime.nextAiringEpisode?.episode} in ${timeFrame}`; + return `${anime.nextAiringEpisode?.episode} in ${ + few ? '' : '' + }${timeFrame}${few ? '' : ''}`; } } -- cgit v1.2.3