[Feature request] Disable rounding in `dayjs.duration().humanize()`
Hi,
It would be nice to have an option for { seconds: 10 } to output 10 seconds rather than a few seconds, and more importantly, for { minutes: 45 } to output 45 minutes rather than an hour.
Thanks
Hi! I’d like to work on this feature request to add an option to disable rounding in dayjs.duration().humanize(). Could you please assign this issue to me?
Hello @KaKi87 and maintainers, I'm a new contributor working on a university project, and I would love to implement this feature.
After reviewing the code, I've developed a solution and wanted to propose it here. My approach is to: 1.Update duration.humanize() to accept an options object (e.g., humanize({ round: false })). 2.If round: false is passed, the function bypasses the relativeTime's fromNow() logic and manually formats a precise string (like "45 minutes"). 3.If no options are passed (or round is not false), it uses the original fromNow() logic to ensure 100% backward compatibility. 4.To support this, I've also added an ss: '%d seconds' string to the relativeTime locale, as requested in the issue.
I've already implemented this solution on my fork, and it passes all npm run lint and npm test checks, including the 100% test coverage requirement. May I please be assigned to this issue? If so, I am ready to open a Pull Request for your review immediately.
Thank you!