Created
May 23, 2015 11:30
-
-
Save farnabaz/d4bdee0f51a890b2266b to your computer and use it in GitHub Desktop.
Simple Angular timer filter
This file contains 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
// usage {{ 122 | timer }} | |
.filter("timer", function () { | |
return function (time) { | |
var sec = time % 60, | |
min = parseInt(time/60) % 60, | |
hou = parseInt(time/3600) % 60 | |
sec < 10 && (sec = '0'+sec) | |
min < 10 && (min = '0'+min) | |
hou < 10 && (hou = '0'+hou) | |
return hou+":"+min+":"+sec | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment