Skip to content

Conversation

@ghost
Copy link

@ghostghost commented Jul 20, 2018

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.

PS:Since this is a private function with n a decimal number, so I suspect the code writer wanted to use toString(10) to convert a number to a two-digit number, and if the number < 10, a 0 is automatically added before the number itself. Obveriously this isn't a right way. Though the final answer is right.

Hope you all take what I mean.

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

lib/util.js Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, we can likely just use padString() ... e.g.

functionpad(n){returnString(n).padStart(2,0);}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it, sorry to forget that!
Many thanks!

@lpinca
Copy link
Member

@ghost
Copy link
Author

@lpinca:It seems that the CI is passed but the status is still pending (in yellow). So I rebase and merged from the latest original Node and submit again. Is it need to restart another CI ? If yes, plz help me.
Thanks anyway!

@lpinca
Copy link
Member

@ghostghost mentioned this pull request Aug 4, 2018
4 tasks
`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.
@ghost
Copy link
Author

@Trott:Maybe this can merged?

@jasnell
Copy link
Member

@TrottTrott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 11, 2018
@Trott
Copy link
Member

@TrottTrott added the util Issues and PRs related to the built-in util module. label Aug 11, 2018
@jasnell
Copy link
Member

@jasnell
Copy link
Member

Seemingly unrelated failure in freebsd... trying once again https://ci.nodejs.org/job/node-test-commit-freebsd/19575/

@BridgeAR
Copy link
Member

BridgeAR commented Aug 13, 2018

@ghost
Copy link
Author

@BridgeAR:Can this be merged? It seems test-commit always with errors... :(
The state is pending.....

@rubys
Copy link
Member

Rebuilding freebsd again: https://ci.nodejs.org/job/node-test-commit-freebsd/19869/; failure matches #22317 which indicates that #22301 temporarily fixes the problem.

@ghost
Copy link
Author

@Trott:Free-bsd passes correctly.

@rubys
Copy link
Member

Landed: 6e9e150

Thanks!

@rubysrubys closed this Aug 21, 2018
rubys pushed a commit that referenced this pull request Aug 21, 2018
`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]>
@ghost
Copy link
Author

Thanks all :D

targos pushed a commit that referenced this pull request Aug 21, 2018
`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]>
targos pushed a commit that referenced this pull request Sep 3, 2018
`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]>
@targostargos mentioned this pull request Sep 5, 2018
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.utilIssues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@lpinca@jasnell@Trott@BridgeAR@rubys@sagirk@trivikr