Skip to content

feat: Add lease duration formatter with singular/plural handling#12

Merged
jftuga merged 1 commit intomasterfrom
shorten-lease-duration
Mar 30, 2025
Merged

feat: Add lease duration formatter with singular/plural handling#12
jftuga merged 1 commit intomasterfrom
shorten-lease-duration

Conversation

@jftuga
Copy link
Copy Markdown
Owner

@jftuga jftuga commented Mar 30, 2025

Purpose

This PR (only applicable on MacOS) introduces two functions for formatting lease duration strings:

ShortenLeaseDuration - Trims trailing zero time units (e.g., "1 days, 0 hrs, 0 mins, 0 secs" → "1 days")
FormatWithCorrectPlurals - Ensures proper singular forms for units with value of 1 (e.g., "1 days" → "1 day")

These functions are combined to provide clean, readable output for lease duration displays.

Example - old lease duration format

1 days, 0 hrs, 0 mins, 0 sec

Exampe - new lease duration format

1 day

@jftuga jftuga force-pushed the shorten-lease-duration branch from 05e5f69 to 7422ec1 Compare March 30, 2025 14:19
@jftuga jftuga merged commit 87fedbc into master Mar 30, 2025
@jftuga jftuga deleted the shorten-lease-duration branch March 30, 2025 14: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