-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format from duration to string #1
Comments
It's not implemented. I want to implement it very much, but I'm not sure how to implement it so that it suits most users. I mean there are a lot of options on length, rounding and other aspects of formatting. Still it's a good idea to do. Do you know any good examples in other languages to compare? |
I suppose I would start off by implementing the same format that your parse_duration helper uses. From there, perhaps create constants for different kinds of formats you can serialize and deserialize. As for alternative formats, you can look at rails: time_ago_in_words(3.minutes.from_now) # => 3 minutes from_time = Time.now - 3.days - 14.minutes - 25.seconds from_time = (3.days + 14.minutes + 25.seconds).ago |
It must support round-tripping the date. But:
Will yield something unreadable like:
This isn't something users want to see. We want something like this:
More questions:
|
|
@tailhook Any additional thoughts to this spec? |
I'm sure some questions will pop up during the implementation. Probably, I will not have time to tackle this soon. Do you want to make a PR? |
Okay, just pushed |
Can you go from duration to a string? Seems like that would be super useful for view templates in web apps.
The text was updated successfully, but these errors were encountered: