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

How to Format? #11

Open
brucfo opened this issue Apr 26, 2014 · 1 comment
Open

How to Format? #11

brucfo opened this issue Apr 26, 2014 · 1 comment

Comments

@brucfo
Copy link

brucfo commented Apr 26, 2014

Hi,

I'm with problem, when I have the time 01:00.00 or 01:00 the time when start show 59 or 59.xx (milliseconds) how to format to 00:59.xx and 00:59 How can I format this way?

@glaucocustodio
Copy link

To display 02:10:08 instead 2:10:8 you can use this code:

format: function(m, s){
  var sec = Math.floor((m / 1000) % 60);
  var min = Math.floor((m / 60000) % 60);
  var hor = Math.floor((m / 3600000) % 24);

  sec = sec < 10 ? '0' + sec : sec;
  min = min < 10 ? '0' + min : min;
  hor = hor < 10 ? '0' + hor : hor;
  return hor + ':' + min + ':' + sec;
}

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

2 participants