From 1790a3f5447907338cdbbfc9f44256cf74f36e31 Mon Sep 17 00:00:00 2001 From: Joel Stålnacke Date: Sat, 2 Aug 2025 18:28:44 +0300 Subject: Rebrand to Aamukampa --- Aamukampa.Core/Library.fs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Aamukampa.Core/Library.fs (limited to 'Aamukampa.Core/Library.fs') diff --git a/Aamukampa.Core/Library.fs b/Aamukampa.Core/Library.fs new file mode 100644 index 0000000..aa7b7ea --- /dev/null +++ b/Aamukampa.Core/Library.fs @@ -0,0 +1,27 @@ +namespace TJLaskuri.Core + +open System + +module Domain = + // TODO: More precise time: hours, minutes + // TODO: Time until service starts + + let getStartDate kontingent = + match serviceStartDates.TryGetValue(kontingent) with + | true, startDate -> Some startDate + | false, _ -> None + + let getEndDate kontingent serviceTime = + getStartDate kontingent + |> Option.map (fun startDate -> + ServiceTime.getDays serviceTime + |> fun x -> x - 1 // Count start date as well + |> startDate.AddDays) + + let getTimeCompleted kontingent (now : DateTime) = + getStartDate kontingent + |> Option.map (fun date -> now.AddDays(1) - date) + + let getTimeLeft kontingent serviceTime (now : DateTime) = + getEndDate kontingent serviceTime + |> Option.map (fun date -> date - now) -- cgit v1.2.3