Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#125 Added US Culture as a constant. #144

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions subtrack.MAUI/Pages/SubscriptionDetails.razor
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ else
<div class="row py-2 @CssUtil.GetDueClass(_nextPaymentDate.TimeRemainingFromToday(dateTimeProvider).Days)">
<div class="col-12 d-flex flex-column justify-content-center">
<label class="detail-label-fs opacity-75">Next payment</label>
<div class="text-center">@_nextPaymentDate.ToString("MMMM dd, yyyy", _usCulture)</div>
<div class="text-center">@_nextPaymentDate.ToString("MMMM dd, yyyy", Constants.UsCulture)</div>
<div class="text-center">@_dueTimeText</div>
</div>
</div>
Expand All @@ -59,7 +59,7 @@ else
<hr />
<label class="opacity-75 detail-label-fs">Latest payment</label>
<div class="col-12 d-flex justify-content-center">
@_subscription.LastPayment.ToString("MMMM dd, yyyy", _usCulture)
@_subscription.LastPayment.ToString("MMMM dd, yyyy", Constants.UsCulture)
</div>
</div>
<div class="row py-2">
Expand Down Expand Up @@ -105,7 +105,6 @@ else
bool _deleteButtonClicked;

DateTime _nextPaymentDate;
private CultureInfo _usCulture = new CultureInfo("en-US");

protected override async Task OnInitializedAsync()
{
Expand Down Expand Up @@ -163,7 +162,7 @@ else
return sb.ToString();
}

sb.Append(_subscription.BillingInterval.ToWords(_usCulture));
sb.Append(_subscription.BillingInterval.ToWords(Constants.UsCulture));
sb.Append(" ");
sb.Append(_subscription.BillingOccurrence.Humanize().ToLower().Pluralize());
return sb.ToString();
Expand Down
8 changes: 8 additions & 0 deletions subtrack.MAUI/Utilities/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System.Globalization;

namespace subtrack.MAUI.Utilities;

public static class Constants
{
public static readonly CultureInfo UsCulture = new("en-US");
}
2 changes: 1 addition & 1 deletion subtrack.MAUI/Utilities/DateTimeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class DateTimeExtensions

public static DateTime AddWeeks(this DateTime date, int weeks) => date.AddDays(weeks * 7);

public static string MonthName(this DateTime date) => date.ToString("MMMM");
public static string MonthName(this DateTime date) => date.ToString("MMMM", Constants.UsCulture);

public static DateTime LastDayOfMonthDate(this DateTime date) => new(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month));

Expand Down
Loading