Skip to content
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

add support for .format() on .duration() #1769

Closed
ralyodio opened this issue Jul 10, 2014 · 3 comments
Closed

add support for .format() on .duration() #1769

ralyodio opened this issue Jul 10, 2014 · 3 comments

Comments

@ralyodio
Copy link

I would like to be able to format duration as time:
moment.duration(3600, 'seconds')).format('HH:mm:ss');

output should produce 01:00:00

@benmonro
Copy link

👍

@ichernev
Copy link
Contributor

Related to #1698

This is the non-i18n version of the proposal. It should support finding out the tokens, sorting them, figuring out where to overflow (in HH:mm:ss minutes overflow to hours, but hours don't overflow) assign values to all tokens and then display.

Problematic areas are zero tokens (are you ok with 00:00:01?): the function may be given array of formats or assume the tokens are sorted in the string and slice from the first non-zero token to the end.

@icambron
Copy link
Member

Marking as a dupe of #1698.

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

No branches or pull requests

4 participants