Skip to content
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

[Feature] Add maxUnit to prettyDuration #65

Open
akurnaz opened this issue Aug 8, 2023 · 0 comments
Open

[Feature] Add maxUnit to prettyDuration #65

akurnaz opened this issue Aug 8, 2023 · 0 comments

Comments

@akurnaz
Copy link

akurnaz commented Aug 8, 2023

Hi,

The number of units can be fixed using "tersity" and "upperTersity", but it would be nice if it was determined by "upperTersity".

For example:

prettyDuration(
          const Duration(seconds: 5),
          abbreviated: true,
          tersity: DurationTersity.second,
          upperTersity: DurationTersity.week,
          //maxUnit: 2,
)

Current: 5s
Expectation: 5s

prettyDuration(
          const Duration(hours: 8, minutes: 3, seconds: 5),
          abbreviated: true,
          tersity: DurationTersity.second,
          upperTersity: DurationTersity.week,
          //maxUnit: 2,
)

Current: 8h, 3mins, 5s
Expectation: 8h, 3mins

prettyDuration(
          const Duration(days: 10, hours: 8, minutes: 3, seconds: 5),
          abbreviated: true,
          tersity: DurationTersity.second,
          upperTersity: DurationTersity.week,
          //maxUnit: 2,
)

Current: 1w, 3d, 8h, 3mins, 5s
Expectation: 1w, 3d

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

No branches or pull requests

1 participant