From 6334238362c13e8c081e27d53d7a11077d360b42 Mon Sep 17 00:00:00 2001 From: David Michaels Date: Mon, 9 Sep 2024 15:58:50 -0400 Subject: [PATCH] minor fix to misc_utils.format_duration --- CHANGELOG.rst | 1 + dcicutils/misc_utils.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index aa87fe536..489694236 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,7 @@ Change Log * Minor changes to view_portal_object utility script. * Minor changes to validators hooks in structured_data. * Added portal_utils.Portal.get_version method. +* Minor fix in misc_utils.format_duration. 8.14.3 diff --git a/dcicutils/misc_utils.py b/dcicutils/misc_utils.py index 5de86755e..2df638862 100644 --- a/dcicutils/misc_utils.py +++ b/dcicutils/misc_utils.py @@ -2802,7 +2802,7 @@ def format_duration(seconds: Union[int, float]) -> str: durations = [("year", 31536000), ("day", 86400), ("hour", 3600), ("minute", 60), ("second", 1)] parts = [] for name, duration in durations: - if seconds >= duration: + if (seconds == 0) or (seconds >= duration): count = seconds // duration seconds %= duration if count != 1: diff --git a/pyproject.toml b/pyproject.toml index 3c928af98..7960efa50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicutils" -version = "8.14.3.1b4" # TODO: To become 8.14.4 +version = "8.14.3.1b5" # TODO: To become 8.14.4 description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" authors = ["4DN-DCIC Team "] license = "MIT"