Skip to content

Instantly share code, notes, and snippets.

@diverted247
Created August 27, 2015 18:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diverted247/1b8335579f1fa31ed6e2 to your computer and use it in GitHub Desktop.
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
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