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

Format zero Durations as "0 seconds" instead of "0 microseconds" #744

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

florish
Copy link

@florish florish commented May 11, 2023

Summary of changes

While building a visual interface including a duration for a certain procedure, I noticed that calling the following:

0
|> Timex.Duration.from_seconds()
|> Timex.Format.Duration.Formatter.lformat(0, "en", :humanized)

...returns the string "0 microseconds". While technically 100% correct, from a "humanized" point of view, this feels a bit odd, as nobody would ever describe a zero-second duration as "zero microseconds".

This pull request is actually a change request, but as the core code change was minimal, opening a PR seemed like a more logical choice than opening an issue.

I'd like to receive feedback on (a) whether this is seen as a valuable functional change, and if so, (b) if you would like me to do the remaining work (fixing tests where needed, adding a CHANGELOG line) or that it is preferred to leave this to a core contributor.

Thanks for a great library!

Checklist

  • New functions have typespecs, changed functions were updated
  • Same for documentation, including moduledocs
  • Tests were added or updated to cover changes
  • Commits were squashed into a single coherent commit
  • Notes added to CHANGELOG file which describe changes at a high-level

@florish florish marked this pull request as draft May 11, 2023 09:20
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