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. PR-URL: https://github.com/nodejs/node/pull/21906 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Ruby <rubys@intertwingly.net>
This commit is contained in:
parent
36696cfe84
commit
6e9e150b6a
@ -1349,7 +1349,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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user