diff --git a/payphone/core/formatting.py b/payphone/core/formatting.py index f4e5d82..518ace1 100644 --- a/payphone/core/formatting.py +++ b/payphone/core/formatting.py @@ -206,11 +206,14 @@ def time_to_text(time_diff: timedelta) -> str: str: The string representation. """ - days = time_diff.days + years = time_diff.days // 365 + days = time_diff.days % 365 hours, remainder = divmod(time_diff.seconds, 3600) minutes, seconds = divmod(remainder, 60) parts = [] + if years > 0: + parts.append(f"{years} day{"s" if years != 1 else ""}") if days > 0: parts.append(f"{days} day{"s" if days != 1 else ""}") if hours > 0: