Skip to content

Task 021: Simplify TimeDurationFormatter - #19

Merged
Igloczek merged 3 commits into
masterfrom
task/021-simplify-duration-formatter
Jun 30, 2026
Merged

Igloczek merged 3 commits into
masterfrom
task/021-simplify-duration-formatter

Conversation

@Igloczek

@Igloczek Igloczek commented Jun 30, 2026 •

Copy link
Copy Markdown
Collaborator

Implements tasks/021-simplify-duration-formatter.md from the ponytail audit backlog.

Goal

Replace the ~90 LOC class singleton with a small function using Intl APIs.

Scope

  • Refactor TimeDurationFormatter in src/util-frontend.ts to a plain function (or two: format duration, format relative).
  • Keep Intl.DurationFormat when available; minimal fallback for older browsers.
  • Update all call sites (grep TimeDurationFormatter / timeDurationFormatter).

Acceptance criteria

  • No class TimeDurationFormatter in codebase.
  • Uptime/duration labels in monitor list and details match pre-change output for sample values (0s, 90s, 3600s, 86400s).
  • bun run lint passes.
  • bun run build:frontend succeeds.

Depends on

Nothing.

Verification

bun run lint
bun run build:frontend
rg "TimeDurationFormatter|timeDurationFormatter" src

Audit reference

Finding #25 — TimeDurationFormatter class.

@Igloczek

Copy link
Copy Markdown
Collaborator Author

/ponytail-review

Replaced class singleton with two functions. Same Intl logic, less ceremony.

Lean already. Ship.

5 files changed, 114 insertions(+), 127 deletions(-)

@Igloczek
Igloczek force-pushed the task/021-simplify-duration-formatter branch from 5d103ed to 5c2ee7d Compare June 30, 2026 12:03
Igloczek added 3 commits June 30, 2026 14:26
Replace the ~90 LOC class singleton with module-scoped Intl formatters
and two exported functions: formatDuration() and setDurationFormatLocale().
Update all call sites in lang mixin, Details, and EditMonitor.

Ponytail audit finding #25.
@Igloczek
Igloczek force-pushed the task/021-simplify-duration-formatter branch from 5c2ee7d to 4cb6ec7 Compare June 30, 2026 12:27
@Igloczek
Igloczek merged commit af23115 into master Jun 30, 2026
@Igloczek
Igloczek deleted the task/021-simplify-duration-formatter branch June 30, 2026 12:58
Igloczek added a commit that referenced this pull request Aug 8, 2026
…tter

Task 021: Simplify TimeDurationFormatter
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.

1 participant