Created
June 22, 2012 15:58
-
-
Save timrwood/2973677 to your computer and use it in GitHub Desktop.
Formatted diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pad(input) { | |
if (input < 10) { | |
return '0' + input; | |
} | |
return input; | |
} | |
moment.duration.fn.formatCountdown = function() { | |
var output = [ | |
pad(this.years()), | |
pad(this.months()), | |
pad(this.days()), | |
pad(this.hours()), | |
pad(this.minutes()), | |
pad(this.seconds()) | |
].join(':'); | |
return output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment