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

Add a way to omit last unit #68

Open
ClementCardonnel opened this issue Jan 17, 2024 · 2 comments
Open

Add a way to omit last unit #68

ClementCardonnel opened this issue Jan 17, 2024 · 2 comments

Comments

@ClementCardonnel
Copy link

Hello!
Just a quick word to say that a feature to be able to omit the last unit would be appreciated.

Example
// 
Duration duration = Duration(hours: 4, minutes: 30);

// 4h30min
prettyDuration(
        duration,
        abbreviated: true,
        tersity: DurationTersity.minute,
        delimiter: '',
        spacer: ''
)

I'd like a way to omit the last unit, in this case the minutes. Which would make 4h30.

Thank you for considering this suggestion!

@tejainece
Copy link
Contributor

tejainece commented Aug 21, 2024

Unfortunately this cannot be done currently. However, I can implement it if we fins a good solution.

I guess this only makes sense when there are only two units. What do you expect when there are also weeks in this case?

@ClementCardonnel
Copy link
Author

Yes, I didn't envision another usage than hour and minutes. In fairness, it's not very logical to add a capability that will only be used for a specific combination. But it seems right in this specific use case. Duration for hours and minutes are often expressed that way. Or at least I think so, but maybe it's just me.

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

2 participants