You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I mentioned using the Humanize method for this, but it would require adding at least one new optional parameter, right? Would it make more sense to introduce new extension methods for TimeSpan instead? I was thinking of something along the lines of:
ToHyphenatedAge() for the pre-noun adjective form ("a 10-year-old cat") or noun form ("the 10-year-old")
ToAge(), for the post-noun adjective form ("the cat is 10 years old")
Not quite sure how to better express it succinctly... 🤔 Suggestions are welcome.
ToAge() could return the same thing as Humanize(maxUnit: TimeUnit.Year)(until someone defines a different culture-specific behavior, if need be)
ToHyphenatedAge could simply return an empty string (as most cultures know nothing about hyphenated age, what other default value would make more sense?)
Using a TimeSpan to express an age, I would like to output that information in one of 2 ways
"10-week-old"
cat), or"10 weeks old"
)If you feel it would benefit the product, I'd be interested in implementing it.
The text was updated successfully, but these errors were encountered: