-
Notifications
You must be signed in to change notification settings - Fork 541
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 a Duration #197
Comments
Our duration is a re-export of but just using |
The relationship between I can definitely roll my own from the I had bean hoping that there would be a |
Yeah actually I think that we are incorrectly exposing
We could probably make that happen with our own format trait, and IMO that does belong in this lib. I'll add that as a wishlist item. |
@burkadurka came up with some clever workarounds. |
That's nifty. I'm tempted to add that as a utility method to chrono as a quick way to use strptime formatting with durations. |
Sorry to necro an old issue, but I wanted to throw in my 2c. @quodlibetor's suggestion of allowing a formatting string would be a step in the right direction, but I think it would be even better to support (in addition to) a more human-readable format, like the one used by Google's I think a large part of it is because it's easy to print and parse, which are critical for debugging and normal usage of most types. Additionally, command line apps really benefit from being able to parse that format, since it's quite human-readable. |
I wish chrono had means of custom formatting for durations with the For example something like this JavaScript API with the template string would be very helpful: moment.duration(123, "minutes").format("h:mm");
// "2:03" |
I'd suggest at least adding this example to the docs (from the Reddit link posted earlier): |
I am new to the library But I am not seeing how to format a Duration, nor how to convert to any of the other types with formatting abilities.
The text was updated successfully, but these errors were encountered: