Created
August 27, 2015 18:58
-
-
Save diverted247/1b8335579f1fa31ed6e2 to your computer and use it in GitHub Desktop.
Timecode Filter in Vuejs... Pass seconds as number returns formatted minutes and seconds
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
Vue.filter( 'timecode' , function( value ){ | |
var seconds = Math.floor( value % 60 ).toString(); | |
var minutes = Math.floor( value / 60 ).toString(); | |
if( seconds.length === 1 ){ | |
seconds = '0' + seconds; | |
} | |
return minutes + ':' + seconds; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment