feat(number-format): Add duration formatter with colon notation (#30593)

This commit is contained in:
Michael Gerber 2024-10-24 19:43:04 +02:00 committed by GitHub
parent ec2d3307fd
commit 3d443e0126
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -57,6 +57,7 @@ export const D3_FORMAT_OPTIONS: [string, string][] = [
...d3Formatted,
['DURATION', t('Duration in ms (66000 => 1m 6s)')],
['DURATION_SUB', t('Duration in ms (1.40008 => 1ms 400µs 80ns)')],
['DURATION_COL', t('Duration in ms (10500 => 0:10.5)')],
['MEMORY_DECIMAL', t('Memory in bytes - decimal (1024B => 1.024kB)')],
['MEMORY_BINARY', t('Memory in bytes - binary (1024B => 1KiB)')],
];

View File

@ -78,6 +78,10 @@ export default function setupFormatters(
'DURATION_SUB',
createDurationFormatter({ formatSubMilliseconds: true }),
)
.registerValue(
'DURATION_COL',
createDurationFormatter({ colonNotation: true }),
)
.registerValue('MEMORY_DECIMAL', createMemoryFormatter({ binary: false }))
.registerValue('MEMORY_BINARY', createMemoryFormatter({ binary: true }));