Skip to content

Commit

Permalink
feat(number-format): Add duration formatter with colon notation (#30593)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerbermichi authored Oct 24, 2024
1 parent ec2d330 commit 3d443e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)')],
];
Expand Down
4 changes: 4 additions & 0 deletions superset-frontend/src/setup/setupFormatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }));

Expand Down

0 comments on commit 3d443e0

Please sign in to comment.