From 8a0be19abe1007b4c1bc38eeba9ca0f3b27811b6 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Wed, 26 Feb 2020 19:55:29 -0800 Subject: [PATCH] Support short values in --- src/Components/Web/src/Forms/InputNumber.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Components/Web/src/Forms/InputNumber.cs b/src/Components/Web/src/Forms/InputNumber.cs index 09327bcae6..efdb53c905 100644 --- a/src/Components/Web/src/Forms/InputNumber.cs +++ b/src/Components/Web/src/Forms/InputNumber.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Components.Forms { /// /// An input component for editing numeric values. - /// Supported numeric types are , , , , . + /// Supported numeric types are , , , , , . /// public class InputNumber : InputBase { @@ -22,6 +22,7 @@ namespace Microsoft.AspNetCore.Components.Forms var targetType = Nullable.GetUnderlyingType(typeof(TValue)) ?? typeof(TValue); if (targetType == typeof(int) || targetType == typeof(long) || + targetType == typeof(short) || targetType == typeof(float) || targetType == typeof(double) || targetType == typeof(decimal)) @@ -86,6 +87,9 @@ namespace Microsoft.AspNetCore.Components.Forms case long @long: return BindConverter.FormatValue(@long, CultureInfo.InvariantCulture); + case short @short: + return BindConverter.FormatValue(@short, CultureInfo.InvariantCulture); + case float @float: return BindConverter.FormatValue(@float, CultureInfo.InvariantCulture);