From 0cb80a9665fe3d6f0d33bcca398fedaa741da320 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.net>
Date: Tue, 28 Apr 2026 05:29:28 -0700
Subject: fix(airing): round residual hour and minute in AiringTime component

---
 src/lib/Media/Anime/Airing/AiringTime.svelte | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

(limited to 'src/lib/Media/Anime/Airing/AiringTime.svelte')

diff --git a/src/lib/Media/Anime/Airing/AiringTime.svelte b/src/lib/Media/Anime/Airing/AiringTime.svelte
index be5f40d9..02e80d1f 100644
--- a/src/lib/Media/Anime/Airing/AiringTime.svelte
+++ b/src/lib/Media/Anime/Airing/AiringTime.svelte
@@ -57,8 +57,11 @@ const setAiringTime = () => {
 			hours = minutes / 60;
 
 			if (hours > 24) {
-				const days = Math.floor(hours / 24);
+				const totalHours = Math.round(hours);
+				const days = Math.floor(totalHours / 24);
+				const residualHours = totalHours % 24;
 				const weeks = Math.floor(days / 7);
+				const residualDays = days % 7;
 
 				few = false;
 
@@ -67,8 +70,6 @@ const setAiringTime = () => {
 						weeks === 1 || shortenCountdown ? "" : "s"
 					}`;
 
-					const residualDays = days % 7;
-
 					if (residualDays > 0)
 						timeFrame += `${shortenCountdown ? "" : " "}${residualDays}${
 							shortenCountdown ? "d" : " day"
@@ -79,17 +80,16 @@ const setAiringTime = () => {
 					}`;
 				}
 
-				const residualHours = Math.floor(hours - days * 24);
-
 				if (residualHours > 0)
 					timeFrame += `${shortenCountdown ? "" : " "}${residualHours}${
 						shortenCountdown ? "h" : " hour"
 					}${residualHours === 1 || shortenCountdown ? "" : "s"}`;
 			} else {
-				const residualMinutes = Math.round(minutes - Math.floor(hours) * 60);
+				const displayHours = Math.floor(minutes / 60);
+				const residualMinutes = minutes % 60;
 
-				timeFrame += `${Math.floor(hours).toFixed(0)}${shortenCountdown ? "h" : " hour"}${
-					Math.floor(hours) === 1 || shortenCountdown ? "" : "s"
+				timeFrame += `${displayHours}${shortenCountdown ? "h" : " hour"}${
+					displayHours === 1 || shortenCountdown ? "" : "s"
 				}`;
 
 				if (residualMinutes > 0)
-- 
cgit v1.2.3

