Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
util: Fix number format for pad
`pad` is now using `toString(10)`, actually we don't need to do this. As for https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString, `toString(N)` is a radix converter, which isn't proper here for time conversion.
  • Loading branch information
MaleDong committed Aug 11, 2018
commit 4edc8f8c334519907b04371e8bfe9e83e6294778
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ function isPrimitive(arg) {
}

function pad(n) {
return n < 10 ? `0${n.toString(10)}` : n.toString(10);
return n.toString().padStart(2, '0');
}

const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
Expand Down