Skip to content

Commit

Permalink
Merge branch 'release/2.7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaben committed Feb 19, 2025
2 parents 857abf8 + 256c636 commit 3c4a477
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Domain/Dimensions/Dimension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// limitations under the License.

using System.ComponentModel;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -88,7 +89,7 @@ public static Dimension Parse(string dimension)
if (!match.Success)
throw new ArgumentException("Invalid dimension format. Expected formats: '200px', '11in', or default to inches.", nameof(dimension));

double value = double.Parse(match.Groups[1].Value);
double value = double.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture);
string? unitStr = match.Groups[3].Success ? match.Groups[3].Value.ToLower() : null;

// Default to Inches if no unit is provided
Expand Down Expand Up @@ -149,7 +150,7 @@ public override string ToString()
// if it's inches, don't supply anything.
var unitType = UnitType == DimensionUnitType.Inches ? "" : UnitType.GetDescription();

return $"{Value}{unitType}";
return $"{Value.ToString("G", CultureInfo.InvariantCulture)}{unitType}";
}

public override bool Equals(object? obj)
Expand Down

0 comments on commit 3c4a477

Please sign in to comment.