aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Media/anime.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/Media/anime.ts b/src/lib/Media/anime.ts
index 5e5bfd68..5e17025f 100644
--- a/src/lib/Media/anime.ts
+++ b/src/lib/Media/anime.ts
@@ -30,13 +30,14 @@ export const airingTime = (anime: Media, upcoming = false) => {
hour: 'numeric',
minute: '2-digit'
});
+ let hours = null;
if (untilAiring !== undefined) {
let minutes = untilAiring / 60;
let few = true;
if (minutes >= 30) {
- let hours = minutes / 60;
+ hours = minutes / 60;
if (hours >= 24) {
let weeks = Math.floor(Math.floor(hours / 24) / 7);
@@ -66,11 +67,15 @@ export const airingTime = (anime: Media, upcoming = false) => {
const opacity = Math.round(100 - (untilAiring / 60 / 60 / 24 / 7) * 50);
if (upcoming) {
- return `<span style="opacity: ${opacity}%">${anime.nextAiringEpisode?.episode}${totalEpisodes(
+ return `<span title="${
+ hours ? `${hours.toFixed(2)} hours` : ''
+ }" style="opacity: ${opacity}%">${anime.nextAiringEpisode?.episode}${totalEpisodes(
anime
)} in ${timeFrame} <span style="opacity: 50%">${few ? `(${time})` : ''}</span></span>`;
} else {
- return `<span style="opacity: ${opacity}%">${anime.nextAiringEpisode?.episode} in ${
+ return `<span title="${
+ hours ? `${hours.toFixed(2)} hours` : ''
+ }" style="opacity: ${opacity}%">${anime.nextAiringEpisode?.episode} in ${
few ? '<b>' : ''
}${timeFrame}${few ? '</b>' : ''} ${few ? `(${time})` : ''}</span>`;
}