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 d972608ad5
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:
Ildar Kamalov 2025-03-07 16:42:37 +03:00
parent 0d2163c1d6
commit 64994c7fcb
2 changed files with 6 additions and 3 deletions
CHANGELOG.md
client/src/helpers

View file

@ -20,6 +20,7 @@ NOTE: Add new changes BELOW THIS COMMENT.
### Fixed
- Formatting of elapsed times less than one millisecond.
- 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]).

View file

@ -669,15 +669,17 @@ export const countClientsStatistics = (ids: any, autoClients: any) => {
* @returns {string}
*/
export const formatElapsedMs = (elapsedMs: string, t: (key: string) => string) => {
const parsedElapsedMs = parseInt(elapsedMs, 10);
const parsedElapsedMs = parseFloat(elapsedMs);
if (Number.isNaN(parsedElapsedMs)) {
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')}`;
};
/**