aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Media
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-10-15 21:28:17 -0700
committerFuwn <[email protected]>2023-10-15 21:28:17 -0700
commitda94fe88dcf35441205e0c166c6201e57364b350 (patch)
tree42d13633f085d6a457996991c6958a05d6e87482 /src/lib/Media
parentfeat(manga): social button (diff)
downloaddue.moe-da94fe88dcf35441205e0c166c6201e57364b350.tar.xz
due.moe-da94fe88dcf35441205e0c166c6201e57364b350.zip
feat(anime): exact time for close upcoming episodes
Diffstat (limited to 'src/lib/Media')
-rw-r--r--src/lib/Media/anime.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/Media/anime.ts b/src/lib/Media/anime.ts
index 19fa693a..9facce8f 100644
--- a/src/lib/Media/anime.ts
+++ b/src/lib/Media/anime.ts
@@ -26,6 +26,10 @@ export const totalEpisodes = (anime: Media) => {
export const airingTime = (anime: Media, upcoming = false) => {
const untilAiring = anime.nextAiringEpisode?.timeUntilAiring;
let timeFrame;
+ const time = new Date(Date.now() + (untilAiring || 0) * 1000).toLocaleTimeString([], {
+ hour: 'numeric',
+ minute: '2-digit'
+ });
if (untilAiring !== undefined) {
let minutes = untilAiring / 60;
@@ -60,11 +64,13 @@ export const airingTime = (anime: Media, upcoming = false) => {
}
if (upcoming) {
- return `${anime.nextAiringEpisode?.episode}${totalEpisodes(anime)} in ${timeFrame}`;
+ return `${anime.nextAiringEpisode?.episode}${totalEpisodes(
+ anime
+ )} in ${timeFrame} <span style="opacity: 50%">${few ? `(${time})` : ''}</span>`;
} else {
return `<span style="opacity: 50%">${anime.nextAiringEpisode?.episode} in ${
few ? '<b>' : ''
- }${timeFrame}${few ? '</b>' : ''}</span>`;
+ }${timeFrame}${few ? '</b>' : ''} ${few ? `(${time})` : ''}</span>`;
}
}