Skip to content

fix(decor): don't wrap styled ETA hours at 60 - #168

Merged
vbauerster merged 2 commits into
vbauerster:masterfrom
ChrisJr404:fix-eta-hours-wrap
Aug 26, 2026
Merged

vbauerster merged 2 commits into
vbauerster:masterfrom
ChrisJr404:fix-eta-hours-wrap

Conversation

@ChrisJr404

Copy link
Copy Markdown
Contributor

Fixes #167.

The HHMMSS, HHMM and MMSS time producers in decor/eta.go apply % 60 to the hours, but hours are the leading unit so they shouldn't wrap. A remaining time of 70h rendered as 10:00:00, and every 60h boundary aliased onto the same output. In the MMSS case the wrapped value also made the hours > 0 check pick the wrong branch past 60h.

Dropped the modulo on hours only, minutes and seconds keep it since they are subdivisions. Added a table test over chooseTimeProducer for each style (those producers had no direct coverage before), including durations past 60h. The test fails on master and passes with the change.

Included the copyright waiver commit per CONTRIBUTING.

I dedicate any and all copyright interest in this software to the
public domain.  I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors.  I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
The hours component in the HHMMSS, HHMM and MMSS time producers was
reduced modulo 60, so a remaining time of 70h rendered as 10:00:00 and
every 60h boundary aliased onto the same output. Hours are the leading
unit here, so they should show the total. Minutes and seconds keep the
% 60 since they are subdivisions.

Closes vbauerster#167
@vbauerster
vbauerster merged commit 600fc4d into vbauerster:master Aug 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ETA formatters wrap hours modulo 60: ET_STYLE_HHMMSS/HHMM/MMSS render 70h remaining as 10:00:00

2 participants