Skip to content

Commit

Permalink
fix: Format big numbers a little more nicely
Browse files Browse the repository at this point in the history
  • Loading branch information
birtles committed Aug 12, 2021
1 parent 5c954b4 commit 4f76acf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ function renderMeasureInfo(meta: MeasureMeta): HTMLElement {

const measureSpan = document.createElement('span');
measureSpan.classList.add('value');
measureSpan.append(String(meta.value));
measureSpan.append(meta.value.toLocaleString());
measureSpan.append(renderUnit(meta.unit));
mainRow.append(measureSpan);

Expand Down Expand Up @@ -667,7 +667,7 @@ function renderMeasureInfo(meta: MeasureMeta): HTMLElement {

function renderValue(value: number): string {
// Round to two decimal places, then to five significant figures
return String(parseFloat(round(value, 2).toPrecision(5)));
return parseFloat(round(value, 2).toPrecision(5)).toLocaleString();
}

function round(value: number, places: number): number {
Expand Down

0 comments on commit 4f76acf

Please sign in to comment.