Skip to content

Commit f86ca89

Browse files
MaleDongtargos
MaleDong
authored andcommitted
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: #21906 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sam Ruby <[email protected]>
1 parent e8e014a commit f86ca89

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/util.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ function isPrimitive(arg) {
13011301
}
13021302

13031303
function pad(n) {
1304-
return n < 10 ? `0${n.toString(10)}` : n.toString(10);
1304+
return n.toString().padStart(2, '0');
13051305
}
13061306

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

0 commit comments

Comments
 (0)