Skip to content

BREAKING(cli/unstable): remove ProgressBarFormatter.styledTime and use DurationFormat #6692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

timreichen
Copy link
Contributor

We should not provide an opinionated time style in the ProgressBarFormatter object, we already provide a defaultFormatter which styles the time.
Instead we should point to Intl.DurationFormat which allows for all kinds of styles.

@timreichen timreichen requested a review from kt3k as a code owner May 28, 2025 21:23
@github-actions github-actions bot added the cli label May 28, 2025
Copy link

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.68%. Comparing base (3d44532) to head (6ddd319).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6692      +/-   ##
==========================================
- Coverage   94.70%   94.68%   -0.02%     
==========================================
  Files         567      567              
  Lines       46793    46797       +4     
  Branches     6582     6582              
==========================================
- Hits        44315    44312       -3     
- Misses       2436     2443       +7     
  Partials       42       42              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kt3k
Copy link
Member

kt3k commented May 29, 2025

We should not provide an opinionated time style in the ProgressBarFormatter object, we already provide a defaultFormatter which styles the time.

I don't see this reasoning. MM:SS is probably most common format for indicating minutes and seconds, and styledTime is convenient shorthand for reusing that format when choosing different style as default formatter. Why do we need to remove it?

@BlackAsLight
Copy link
Contributor

This change doesn't format correctly. It puts everything under the seconds section.

new Intl.DurationFormat(undefined, {
  minutes: "2-digit",
  seconds:"2-digit",
  fractionalDigits: 0
})
  .format({milliseconds: Date.now()});
// "00:1748597655"

Screenshot 2025-05-30 at 19 35 27

@timreichen timreichen marked this pull request as draft May 30, 2025 17:17
@timreichen
Copy link
Contributor Author

This change doesn't format correctly. It puts everything under the seconds section.

new Intl.DurationFormat(undefined, {
  minutes: "2-digit",
  seconds:"2-digit",
  fractionalDigits: 0
})
  .format({milliseconds: Date.now()});
// "00:1748597655"

Screenshot 2025-05-30 at 19 35 27

Good catch!
I think this has to wait until Temporal is stable. Then that can be solved with Temporal.Duration.prototype.round().
Putting this as draft for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants