File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 62
62
}
63
63
else if ( typeof timeCode === 'string' ) {
64
64
// pick it apart
65
- var parts = timeCode . match ( '^([012]\\d):(\\d\\d):(\\d\\d)(:|;|\\.)(\\d\\d )$' ) ;
65
+ var parts = timeCode . match ( '^([012]\\d):(\\d\\d):(\\d\\d)(:|;|\\.)(\\d+ )$' ) ;
66
66
if ( ! parts ) throw new Error ( "Timecode string expected as HH:MM:SS:FF or HH:MM:SS;FF" ) ;
67
67
this . hours = parseInt ( parts [ 1 ] ) ;
68
68
this . minutes = parseInt ( parts [ 2 ] ) ;
180
180
else throw new Error ( 'Unsupported string format' ) ;
181
181
}
182
182
return "" . concat (
183
- this . hours < 10 ? '0' : '' ,
184
- this . hours . toString ( ) ,
183
+ String ( this . hours ) . padStart ( 2 , '0' ) ,
185
184
':' ,
186
- this . minutes < 10 ? '0' : '' ,
187
- this . minutes . toString ( ) ,
185
+ String ( this . minutes ) . padStart ( 2 , '0' ) ,
188
186
':' ,
189
- this . seconds < 10 ? '0' : '' ,
190
- this . seconds . toString ( ) ,
187
+ String ( this . seconds ) . padStart ( 2 , '0' ) ,
191
188
this . dropFrame ? ';' : ':' ,
192
- frames < 10 ? '0' : '' ,
193
- frames . toString ( ) ,
189
+ String ( frames ) . padStart ( String ( Math . round ( this . frameRate ) ) . length , '0' ) ,
194
190
field
195
191
) ;
196
192
} ;
Original file line number Diff line number Diff line change @@ -284,4 +284,12 @@ describe('Issues', function() {
284
284
var t1 = new Timecode ( "10:00:00;06" , 23.976 ) ;
285
285
expect ( t1 . dropFrame ) . to . be ( false ) ;
286
286
} ) ;
287
+
288
+
289
+ it ( '#37 Time Codes >100' , function ( ) {
290
+ var t = new Timecode ( "00:00:10;112" , 200 , false ) ;
291
+ expect ( t . dropFrame ) . to . be ( false ) ;
292
+ expect ( t . frameCount ) . to . be ( 2112 ) ;
293
+ expect ( Timecode ( '12:34:56:578' , 600 ) . toString ( ) ) . to . be ( '12:34:56:578' ) ;
294
+ } ) ;
287
295
} ) ;
You can’t perform that action at this time.
0 commit comments