Pull request: ADG-9715 formatting of elapsed times less than one millisecond
Merge in DNS/adguard-home from ADG-9715 to master Squashed commit of the following: commit d972608ad5429810e0f5ad430f11e037cd05ee40 Author: Ildar Kamalov <ik@adguard.com> Date: Thu Mar 6 12:46:29 2025 +0300 ADG-9715 formatting of elapsed times less than one millisecond
This commit is contained in:
@@ -20,6 +20,7 @@ NOTE: Add new changes BELOW THIS COMMENT.
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Formatting of elapsed times less than one millisecond.
|
||||||
- Changes to global upstream DNS settings not applying to custom client upstream configurations.
|
- Changes to global upstream DNS settings not applying to custom client upstream configurations.
|
||||||
- The formatting of large numbers in the clients tables on the *Client settings* page ([#7583]).
|
- The formatting of large numbers in the clients tables on the *Client settings* page ([#7583]).
|
||||||
|
|
||||||
|
|||||||
@@ -669,15 +669,17 @@ export const countClientsStatistics = (ids: any, autoClients: any) => {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export const formatElapsedMs = (elapsedMs: string, t: (key: string) => string) => {
|
export const formatElapsedMs = (elapsedMs: string, t: (key: string) => string) => {
|
||||||
const parsedElapsedMs = parseInt(elapsedMs, 10);
|
const parsedElapsedMs = parseFloat(elapsedMs);
|
||||||
|
|
||||||
if (Number.isNaN(parsedElapsedMs)) {
|
if (Number.isNaN(parsedElapsedMs)) {
|
||||||
return elapsedMs;
|
return elapsedMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
const formattedMs = formatNumber(parsedElapsedMs);
|
const formattedValue = parsedElapsedMs < 1
|
||||||
|
? parsedElapsedMs.toFixed(2)
|
||||||
|
: Math.floor(parsedElapsedMs).toString();
|
||||||
|
|
||||||
return `${formattedMs} ${t('milliseconds_abbreviation')}`;
|
return `${formattedValue} ${t('milliseconds_abbreviation')}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user