.NET port (written in F#) of the Haskell Rampart library by Taylor Fausak.
Available on Nuget
open FsharpRampart
relate (toInterval (2, 4)) (toInterval (3, 5))
// Output: Overlaps
let dt1 = (DateTime(2020,01,01), DateTime(2020,03,14)) |> toInterval
let dt2 = (DateTime(2019,01,01), DateTime(2020,03,14)) |> toInterval
relate dt1 dt2
//Output: Finishes
invert Before
//Output: After
toInterval (2, 4) |> lesser
// Output: 2
toInterval (2, 4) |> greater
// Output: 4
toInterval (2, 2) |> isEmpty
// Output: true
toInterval (2, 3) |> isEmpty
// Output: false
toInterval (2, 3) |> isNonEmpty
// Output: true
Usage is similar but to make it easier to consume using directives will be needed depending on which module the function is in.
using FsharpRampart;
using static FsharpRampart.Interval;
relate(toInterval(2, 4), toInterval(3, 5));
//Output: Overlaps
var dt1 = toInterval(new DateTime(2020,01,01), new DateTime(2020,03,14));
var dt2 = toInterval(new DateTime(2019,01,01), new DateTime(2020,03,14));
relate(dt1, dt2);
//Output: Finishes
invert(Relation.Before);
//Output: After