File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change 36
36
"base32-encode" : " ^1.1.0" ,
37
37
"debug" : " ^4.1.1" ,
38
38
"interface-datastore" : " ~0.6.0" ,
39
- "left-pad" : " ^1.3.0" ,
40
39
"libp2p-crypto" : " ~0.16.0" ,
41
40
"multihashes" : " ~0.4.14" ,
42
41
"peer-id" : " ~0.12.2" ,
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- const leftPad = require ( 'left-pad' )
4
-
5
3
/**
6
4
* Convert a JavaScript date into an `RFC3339Nano` formatted
7
5
* string.
@@ -11,11 +9,11 @@ const leftPad = require('left-pad')
11
9
*/
12
10
module . exports . toRFC3339 = ( time ) => {
13
11
const year = time . getUTCFullYear ( )
14
- const month = leftPad ( time . getUTCMonth ( ) + 1 , 2 , '0' )
15
- const day = leftPad ( time . getUTCDate ( ) , 2 , '0' )
16
- const hour = leftPad ( time . getUTCHours ( ) , 2 , '0' )
17
- const minute = leftPad ( time . getUTCMinutes ( ) , 2 , '0' )
18
- const seconds = leftPad ( time . getUTCSeconds ( ) , 2 , '0' )
12
+ const month = String ( time . getUTCMinutes ( ) + 1 ) . padStart ( 2 , '0' )
13
+ const day = String ( time . getUTCDate ( ) ) . padStart ( 2 , '0' )
14
+ const hour = String ( time . getUTCHours ( ) ) . padStart ( 2 , '0' )
15
+ const minute = String ( time . getUTCMinutes ( ) ) . padStart ( 2 , '0' )
16
+ const seconds = String ( time . getUTCSeconds ( ) ) . padStart ( 2 , '0' )
19
17
const milliseconds = time . getUTCMilliseconds ( )
20
18
const nanoseconds = milliseconds * 1000 * 1000
21
19
You can’t perform that action at this time.
0 commit comments