-
Notifications
You must be signed in to change notification settings - Fork 120
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
[SOLVED] moment.duration.format to show 12 sec in the format 00:12 (mm:ss) #68
Comments
In your case you'd want this:
```
moment.duration(12, "seconds").format('mm:ss', { trim: false });
// "00:12"
```
`forceLength` acts on individual tokens that aren't trimmed, when the
leading token in the format string has a length of `1`. Sounds more
complicated that it is...
…On Thu, Mar 16, 2017 at 11:03 AM, Giovanni Fontana ***@***.*** > wrote:
Hi.
How can I use the format to show for example 12 seconds in the format
00:12 and not only 12?
I used format('mm:ss', { forceLength: true } but it does not work.
Thank you.
Giovanni.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#68>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABN2iAnlY9dobIGwCkxJNm45EHlYRmyTks5rmU8mgaJpZM4Mfbj6>
.
--
John Madhavan-Reese
Support Team Lead
You.i TV
[email protected]
|
Thank you very much! |
No. Is not working as expected
|
@mikeevstropov what environment are you using? A quick check in Chrome and I see: moment.duration(12, "seconds").format('mm:ss', { trim: false })
// "00:12"
moment.duration(12, "seconds").format('mm:ss', { trim: false })
// "00:12"
moment.duration(1200, "seconds").format('hh:mm', { trim: false })
// "00:20" The output padding in version 2 comes from |
@jsmreese Hi! Thank you for fast reply =) React Native (android)
|
That explains it. As I'm learning, there are lots of environments where you can use moment that don't provide a fully baked I'll see what I can do about getting a fallback implementation of |
Hi.
How can I use the format to show for example 12 seconds in the format 00:12 and not only 12?
I used format('mm:ss', { forceLength: true } but it does not work.
Thank you.
Giovanni.
The text was updated successfully, but these errors were encountered: