aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-12-13 04:34:11 -0800
committerFuwn <[email protected]>2023-12-13 04:34:11 -0800
commit25ec2856a0c93fff8ea726636d4ed3c1c65bcd83 (patch)
tree3c280950c2fd5b4899e2c6a4feed3192d14ae4fc /src/lib
parentfeat(anime): update airing time (diff)
downloaddue.moe-25ec2856a0c93fff8ea726636d4ed3c1c65bcd83.tar.xz
due.moe-25ec2856a0c93fff8ea726636d4ed3c1c65bcd83.zip
feat(anime): better time display
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Media/anime.ts12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/Media/anime.ts b/src/lib/Media/anime.ts
index 24c869d9..16deb5fe 100644
--- a/src/lib/Media/anime.ts
+++ b/src/lib/Media/anime.ts
@@ -37,7 +37,7 @@ export const airingTime = (anime: Media, upcoming = false) => {
let minutes = untilAiring / 60;
let few = true;
- if (minutes >= 30) {
+ if (minutes > 60) {
hours = minutes / 60;
if (hours >= 24) {
@@ -52,12 +52,10 @@ export const airingTime = (anime: Media, upcoming = false) => {
// } else {
const days = Math.round(Math.floor(hours / 24));
- timeFrame = `${days} day${days === 1 ? '' : 's'}`;
+ timeFrame = `${days.toFixed(0)} day${days === 1 ? '' : 's'}`;
// }
} else {
- hours = Math.round(hours);
-
- timeFrame = `${hours} hour${hours === 1 ? '' : 's'}`;
+ timeFrame = `${hours.toFixed(1)} hour${hours === 1 ? '' : 's'}`;
}
} else {
minutes = Math.round(minutes);
@@ -69,13 +67,13 @@ export const airingTime = (anime: Media, upcoming = false) => {
if (upcoming) {
return `<span title="${
- hours ? `${hours.toFixed(2)} hours` : ''
+ hours ? `${hours.toFixed(3)} hours` : ''
}" style="opacity: ${opacity}%">${anime.nextAiringEpisode?.episode}${totalEpisodes(
anime
)} in ${timeFrame} <span style="opacity: 50%">${few ? `(${time})` : ''}</span></span>`;
} else {
return `<span title="${
- hours ? `${hours.toFixed(2)} hours` : ''
+ hours ? `${hours.toFixed(3)} hours` : ''
}" style="opacity: ${opacity}%">${anime.nextAiringEpisode?.episode} in ${
few ? '<b>' : ''
}${timeFrame}${few ? '</b>' : ''} ${few ? `(${time})` : ''}</span>`;