Skip to content

formatter: round CREATED durations consistently with Docker Desktop#6978

Open
texasich wants to merge 1 commit into
docker:masterfrom
texasich:6891-round-created-duration
Open

formatter: round CREATED durations consistently with Docker Desktop#6978
texasich wants to merge 1 commit into
docker:masterfrom
texasich:6891-round-created-duration

Conversation

@texasich
Copy link
Copy Markdown

@texasich texasich commented May 12, 2026

Summary

Why

Fixes inconsistency reported in #6891 where CLI CREATED values diverge from Docker Desktop due to flooring vs rounding behavior.

Scope notes

  • This PR only updates vendored go-units duration formatting used by CLI output
  • No command flags or API behavior changes

Validation

  • Targeted checks run for updated duration formatter and tests:
    • GO111MODULE=off go test ./vendor/github.com/docker/go-units -run TestHumanDuration -count=1
    • GO111MODULE=off go test ./vendor/github.com/docker/go-units -run ExampleHumanDuration -count=1

Fixes #6891

Sync vendored HumanDuration semantics with docker/go-units PR docker#51:
- add shared unit constants and roundDuration helper
- round day/week/month/year outputs consistently
- switch threshold checks to duration-based cutovers

Add vendored duration tests covering boundary transitions and expected
example outputs to guard against regressions in CREATED formatting.

Refs: docker#6891
@sahilsGit
Copy link
Copy Markdown

sahilsGit commented May 13, 2026

These are vendor generated files, not sure modifying these is acceptable or not. The root fix is in go-units but the repo is inactive, it might never get merged is what I believe.

@texasich
Copy link
Copy Markdown
Author

texasich commented May 15, 2026

good catch — agreed we should avoid hand-editing generated/vendor files when possible.

i’ll rework this so the change comes from the non-vendored source path (or isolate the minimal safe workaround if upstream is effectively frozen), then update this PR with the exact provenance in the description so maintainers can audit it quickly.

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.

Inconsistent "CREATED" values between CLI and Docker Desktop

2 participants