-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update all occurrences of MJ utils/formatNumber() function to use default options. #39055
Update all occurrences of MJ utils/formatNumber() function to use default options. #39055
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
In PR #38953, we updated the My Jetpack
formatNumber()
utility function to pass some custom properties to the 2nd "options" parameter of the function by default. The custom default options are:These make the
formatNumber()
function display compact numbers (with 1 decimal) by default. For example: 23,682 displays as23.7K
, or 1,212,000 as1.2M
. This was our main intention/use case for the function.Therefore, this is a follow-up PR: that updates all the other places that we call the My Jetpack formatNumber() function, removing the option parameters we were passing in because they are no longer needed (because as stated above, we now pass them in by default in the function definition).
Fixes #
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
No
Testing instructions:
shortenedNumberConfig
) on each instance where we are calling the My JetpacknumberFormat
utility function.If you want to do a more thorough manual test, follow the following steps below:
JETPACK_SANDBOX__DOMAIN
).public.api/rest/wpcom-json-endpoints/class.wpcom-json-api-stats-highlights-v1-1-endpoint.php
// return $cached_response;
)'views' => 8100,
)/wp-admin/admin.php?page=stats
8.1k
(shortened number format), but the difference should Not have the shortened format (because the value is less than 9999). See screenshot:public.api/rest/wpcom-json-endpoints/class.wpcom-json-api-stats-highlights-v1-1-endpoint.php
'views' => 10100,
)/wp-admin/admin.php?page=stats
10.1k
(shortened number format), and also the difference should have the shortened format also (because the value is greater than 9999). See screenshot: