Skip to content

Add formatDuration function - #119

Merged
Samarth2190 merged 1 commit into
Samarth2190:mainfrom
sabha348:feature/117-format-duration
Oct 13, 2025
Merged

Add formatDuration function#119
Samarth2190 merged 1 commit into
Samarth2190:mainfrom
sabha348:feature/117-format-duration

Conversation

@sabha348

Copy link
Copy Markdown
Contributor

Description of Changes
Implemented a new formatDuration(input, options?) utility function that converts durations (in seconds or milliseconds) to human-readable strings
Added comprehensive test suite covering basic functionality, formatting options, and error handling
Updated module exports to include the new function
Added documentation to the README
Why This Change Is Needed
This enhancement adds a commonly requested utility for working with time durations. The function intelligently formats durations by:

Displaying only non-zero units (unless duration is 0)
Supporting hours, minutes, seconds, and milliseconds
Providing customization options for output format
Handling edge cases appropriately
This addition makes working with time-based data more user-friendly and reduces the need for custom formatting logic in consuming applications.

Test image:
image

Breaking Changes
None. This is a new utility function that doesn't modify any existing functionality.

@Samarth2190 Samarth2190 added gssoc25 GSSOC'25 approved issue Level 3 Hard level Issue labels Oct 13, 2025
@Samarth2190
Samarth2190 merged commit cab1e93 into Samarth2190:main Oct 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc25 GSSOC'25 approved issue Level 3 Hard level Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants