From a8deeb06591f1ce0778f01204b55f1f99608a7d8 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Tue, 10 Nov 2020 09:33:16 -0500 Subject: [PATCH] Minor fixes --- docs/components/format-number.md | 4 ++-- src/components/format-number/format-number.tsx | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/components/format-number.md b/docs/components/format-number.md index bcfd18992..782885c92 100644 --- a/docs/components/format-number.md +++ b/docs/components/format-number.md @@ -4,7 +4,7 @@ Formats a number using the specified locale and options. -Localization is handled by the browser's built-in [Intl: NumberFormat API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat). As such, there's no need to load language packs or omit those you don't plan on using. +Localization is handled by the browser's built-in [Intl: NumberFormat API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat) so there's no need to load bulky language packs. ```html preview
@@ -43,7 +43,7 @@ Use the `locale` attribute to set the number formatting locale. ```html preview English:
German:
-Russian:
+Russian: ``` ### Currency diff --git a/src/components/format-number/format-number.tsx b/src/components/format-number/format-number.tsx index d5609ec66..f0b92a7fc 100644 --- a/src/components/format-number/format-number.tsx +++ b/src/components/format-number/format-number.tsx @@ -10,7 +10,7 @@ import { Component, Prop } from '@stencil/core'; shadow: true }) export class FormatBytes { - /** The number to format in bytes. */ + /** The number to format. */ @Prop() value = 0; /** The locale to use when formatting the number. */ @@ -44,9 +44,7 @@ export class FormatBytes { @Prop() maximumSignificantDigits: number; render() { - const number = Number(this.value); - - if (isNaN(number)) { + if (isNaN(this.value)) { return ''; } @@ -60,6 +58,6 @@ export class FormatBytes { maximumFractionDigits: this.maximumFractionDigits, minimumSignificantDigits: this.minimumSignificantDigits, maximumSignificantDigits: this.maximumSignificantDigits - }).format(number); + }).format(this.value); } }