File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ class Timecode extends Component {
2323 return number ;
2424 }
2525
26- formatMilliseconds ( milliseconds ) {
27- return this . pad ( ( milliseconds / 1000 ) . toFixed ( 3 ) * 1000 , 3 ) ;
26+ formatMilliseconds ( milliseconds , length = 3 ) {
27+ return this . pad ( ( milliseconds / 1000 ) . toFixed ( length ) * 1000 , length ) ;
2828 }
2929
3030 formatTimecode ( { hours, minutes, seconds, milliseconds} ) {
@@ -33,20 +33,20 @@ class Timecode extends Component {
3333 } = this . props ;
3434
3535 switch ( format ) {
36- case 'HH:mm:ss.sss ' :
36+ case 'HH:mm:ss.SSS ' :
3737 return `${ this . pad ( hours ) } :${ this . pad ( minutes ) } :${ this . pad ( seconds ) } .${ this . formatMilliseconds ( milliseconds ) } ` ;
3838
39- case 'H:mm:ss.sss ' :
39+ case 'H:mm:ss.SSS ' :
4040 return `${ hours } :${ this . pad ( minutes ) } :${ this . pad ( seconds ) } .${ this . formatMilliseconds ( milliseconds ) } ` ;
4141
42- case 'H:?mm:ss.sss ' :
42+ case 'H:?mm:ss.SSS ' :
4343 if ( hours ) {
4444 return `${ hours } :${ this . pad ( minutes ) } :${ this . pad ( seconds ) } .${ this . formatMilliseconds ( milliseconds ) } ` ;
4545 }
4646
4747 return `${ this . pad ( minutes ) } :${ this . pad ( seconds ) } .${ this . formatMilliseconds ( milliseconds ) } ` ;
4848
49- case 'H:?m:ss.sss ' :
49+ case 'H:?m:ss.SSS ' :
5050 if ( hours ) {
5151 return `${ hours } :${ this . pad ( minutes ) } :${ this . pad ( seconds ) } .${ this . formatMilliseconds ( milliseconds ) } ` ;
5252 }
@@ -69,6 +69,12 @@ class Timecode extends Component {
6969 case 'H:mm' :
7070 return `${ hours } :${ this . pad ( minutes ) } ` ;
7171
72+ case 's.SSS' :
73+ return `${ seconds } .${ this . formatMilliseconds ( milliseconds ) } ` ;
74+
75+ case 's.SS' :
76+ return `${ seconds } .${ this . formatMilliseconds ( milliseconds , 2 ) } ` ;
77+
7278 case 'H:?m:ss' :
7379 default :
7480 if ( hours ) {
You can’t perform that action at this time.
0 commit comments