From 678db933572a09e5a0752014549d84d55e699d4c Mon Sep 17 00:00:00 2001 From: Dominic NEED Date: Wed, 10 Jul 2024 11:52:57 +0100 Subject: [PATCH] Using dateshelper rather than ToFormattedDate --- Dfe.PrepareTransfers.Web/ExtensionMethods/StringExtensions.cs | 2 +- .../Pages/Projects/TransferDates/Reason.cshtml | 3 ++- .../Pages/TaskList/DateHistory/DateHistory.cshtml | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dfe.PrepareTransfers.Web/ExtensionMethods/StringExtensions.cs b/Dfe.PrepareTransfers.Web/ExtensionMethods/StringExtensions.cs index 72a07de6f..c20673a9e 100644 --- a/Dfe.PrepareTransfers.Web/ExtensionMethods/StringExtensions.cs +++ b/Dfe.PrepareTransfers.Web/ExtensionMethods/StringExtensions.cs @@ -123,7 +123,7 @@ public static string RemoveNonAlphanumericOrWhiteSpace(this string str) } public static string ToFormattedDate(this string dateStr) { - if (DateTime.TryParse(dateStr, out DateTime date, )) + if (DateTime.TryParse(dateStr, out DateTime date)) { return date.ToString("d MMMM yyyy"); } diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/TransferDates/Reason.cshtml b/Dfe.PrepareTransfers.Web/Pages/Projects/TransferDates/Reason.cshtml index 876559bb5..442e29d1f 100644 --- a/Dfe.PrepareTransfers.Web/Pages/Projects/TransferDates/Reason.cshtml +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/TransferDates/Reason.cshtml @@ -1,4 +1,5 @@ @page "{urn}/transfer-dates/reason" +@using Dfe.PrepareTransfers.Helpers @using Dfe.PrepareTransfers.Web.ExtensionMethods @model Dfe.PrepareTransfers.Web.Pages.Projects.TransferDates.Reason @{ @@ -23,7 +24,7 @@ Reasons for transfer date change -

The new proposed transfer date is @Model.TargetDate.ToFormattedDate().

+

The new proposed transfer date is @DatesHelper.DateStringToGovUkDate(Model.TargetDate).

diff --git a/Dfe.PrepareTransfers.Web/Pages/TaskList/DateHistory/DateHistory.cshtml b/Dfe.PrepareTransfers.Web/Pages/TaskList/DateHistory/DateHistory.cshtml index f1a51b2f2..25eca7e4e 100644 --- a/Dfe.PrepareTransfers.Web/Pages/TaskList/DateHistory/DateHistory.cshtml +++ b/Dfe.PrepareTransfers.Web/Pages/TaskList/DateHistory/DateHistory.cshtml @@ -2,6 +2,7 @@ @using Dfe.PrepareTransfers.Data.Models @using Dfe.PrepareTransfers.Data.Models.AdvisoryBoardDecision @using Dfe.PrepareTransfers.Data.TRAMS +@using Dfe.PrepareTransfers.Helpers @using Dfe.PrepareTransfers.Web.ExtensionMethods @model Dfe.PrepareTransfers.Web.Pages.TaskList.DateHistory.DateHistory @@ -24,7 +25,7 @@ @if ((Model.OpeningDateHistory == null || !Model.OpeningDateHistory.Any()) && Model.Project.Dates.Target is not null) {

Current proposed transfer date

-

The current proposed transfer date is @Model.Project.Dates.Target.ToFormattedDate().

+

The current proposed transfer date is @DatesHelper.DateStringToGovUkDate(Model.Project.Dates.Target).

} else if ((Model.OpeningDateHistory == null || !Model.OpeningDateHistory.Any()) && Model.Project.Dates.Target is null) {