dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

feat(plugin:duration): Add { round: false } option to humanize()

Open bhavyajain-glitch opened this issue 1 month ago • 0 comments

Hi maintainers!

This PR adds a round: false option to duration.humanize() to allow for unrounded, precise output.

Closes: #2970

Summary Updated duration.humanize() to accept an options object for { round: false } and { withSuffix: true }.

If round: false is passed, it now bypasses the relativeTime thresholds and formats the string manually.

If no options are passed, it defaults to the original, rounding behavior (fully backward-compatible).

Added ss: '%d seconds' to the relativeTime plugin for the new "10 seconds" output.

Added full tests for the new feature, backward compatibility, and fallbacks, maintaining 100% test coverage.

I'm a student working on a university project to learn open source, and I'd be happy to make any changes you suggest. Thanks!

bhavyajain-glitch avatar Nov 17 '25 19:11 bhavyajain-glitch