Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
fix: remove leftpad (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias authored and vasco-santos committed May 23, 2019
1 parent 0d5bfa0 commit 4f46885
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"async": "^2.6.2",
"buffer-split": "^1.0.0",
"err-code": "^1.1.2",
"left-pad": "^1.3.0",
"multihashes": "~0.4.14",
"multihashing-async": "~0.6.0",
"protons": "^1.0.1"
Expand Down
12 changes: 5 additions & 7 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict'

const leftPad = require('left-pad')

/**
* Convert a JavaScript date into an `RFC3339Nano` formatted
* string.
Expand All @@ -11,11 +9,11 @@ const leftPad = require('left-pad')
*/
module.exports.toRFC3339 = (time) => {
const year = time.getUTCFullYear()
const month = leftPad(time.getUTCMonth() + 1, 2, '0')
const day = leftPad(time.getUTCDate(), 2, '0')
const hour = leftPad(time.getUTCHours(), 2, '0')
const minute = leftPad(time.getUTCMinutes(), 2, '0')
const seconds = leftPad(time.getUTCSeconds(), 2, '0')
const month = String(time.getUTCMonth() + 1).padStart(2, '0')
const day = String(time.getUTCDate()).padStart(2, '0')
const hour = String(time.getUTCHours()).padStart(2, '0')
const minute = String(time.getUTCMinutes()).padStart(2, '0')
const seconds = String(time.getUTCSeconds()).padStart(2, '0')
const milliseconds = time.getUTCMilliseconds()
const nanoseconds = milliseconds * 1000 * 1000

Expand Down

0 comments on commit 4f46885

Please sign in to comment.