Timestamp helpers output an incorrect number of days for timestamps above 30 days
The humanTimedelta
and preciseHumanTimedelta
helpers convert an amount of seconds to a readable string. The "precise" version, used for worker activities, shows a combination of multiple units, like 2 days 3 hours 4 minutes 5 seconds 6 milliseconds
. The non-precise version picks the most appropriate unit, like 1 day
when the duration exceeds 24 hours. The largest defined unit is days, so a duration above 30 days should just keep displaying 83 days
. The 30 day limit should only matter for another helper function, ago
, where any date above 30 days is displayed as an absolute RFC 3339 date instead of a readable duration.
I noticed that some old processes that finished without having a finished
date set have strange durations: a process that's 83 days old was displaying Running for 2 days
instead of Running for 83 days
. Turns out it is displaying the number of "months", assuming a month is always exactly 30 days (I love calendars). The "precise" helper instead displays 23 days 22 hours ...
, aka 83 % 30
days.