From b315d3053b897ccde75157838992da3f63dd1ce5 Mon Sep 17 00:00:00 2001 From: Michael Bond Date: Tue, 5 Nov 2024 17:36:36 -0500 Subject: [PATCH] Move dates string to code behind --- AboutMe/Wasm/Pages/Resume.razor | 2 +- AboutMe/Wasm/Pages/Resume.razor.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AboutMe/Wasm/Pages/Resume.razor b/AboutMe/Wasm/Pages/Resume.razor index 3d20bec..791b183 100644 --- a/AboutMe/Wasm/Pages/Resume.razor +++ b/AboutMe/Wasm/Pages/Resume.razor @@ -73,7 +73,7 @@ @job.Company - @($"{job.StartDate:MMM yyyy} - {(job.EndDate is null ? "Present" : $"{job.EndDate:MMM yyyy}")} {(job.YearsAtJob > 0 ? $"({job.YearsAtJob} year{(job.YearsAtJob == 1 ? string.Empty : "s")})" : string.Empty)}") + @job.DatesString diff --git a/AboutMe/Wasm/Pages/Resume.razor.cs b/AboutMe/Wasm/Pages/Resume.razor.cs index 3b53511..c3e5f18 100644 --- a/AboutMe/Wasm/Pages/Resume.razor.cs +++ b/AboutMe/Wasm/Pages/Resume.razor.cs @@ -345,6 +345,9 @@ private readonly struct Job PresentlyEmployed || EndDate is null ? (DateTime.Now - StartDate).Days / 365 : (EndDate.Value - StartDate).Days / 365; + + public string DatesString => + $"{StartDate:MMM yyyy} - {(EndDate is null ? "Present" : $"{EndDate:MMM yyyy}")} {(YearsAtJob > 0 ? $"({YearsAtJob} year{(YearsAtJob == 1 ? string.Empty : "s")})" : string.Empty)}"; } private readonly struct Duty