Skip to content

Commit ac990ad

Browse files
committed
currency fix
1 parent d6dd82a commit ac990ad

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
using System.Globalization;
2+
13
namespace Orbit.Domain.Extensions
24
{
35
public static class CurrencyExtensions
46
{
7+
private static readonly CultureInfo GbCulture = new("en-GB");
8+
59
/// <summary>
610
/// Converts pence (long) to pounds and formats as GBP currency string (e.g., "£123.45")
711
/// </summary>
@@ -10,8 +14,7 @@ public static class CurrencyExtensions
1014
public static string ToPoundsString(this long pence)
1115
{
1216
var pounds = pence / 100m;
13-
var sign = pence < 0 ? "-" : "";
14-
return $"{sign}£{Math.Abs(pounds):N2}";
17+
return pounds.ToString("C", GbCulture);
1518
}
1619

1720
/// <summary>
@@ -22,8 +25,7 @@ public static string ToPoundsString(this long pence)
2225
public static string ToPoundsString(this decimal pence)
2326
{
2427
var pounds = pence / 100m;
25-
var sign = pence < 0 ? "-" : "";
26-
return $"{sign}£{Math.Abs(pounds):N2}";
28+
return pounds.ToString("C", GbCulture);
2729
}
2830
}
2931
}

0 commit comments

Comments
 (0)