diff --git a/projects/GKCore/GDModel/GDMCustomDate.cs b/projects/GKCore/GDModel/GDMCustomDate.cs index 088cf6919..af7cb70b2 100644 --- a/projects/GKCore/GDModel/GDMCustomDate.cs +++ b/projects/GKCore/GDModel/GDMCustomDate.cs @@ -196,7 +196,7 @@ public static GDMDatePeriod GetIntersection(GDMCustomDate range1, GDMCustomDate GDMDate smallestEnd = r1end.IsEmpty() ? r2end : (r2end.IsEmpty() ? r1end : (r1end.CompareTo(r2end) < 0) ? r1end : r2end); // no intersection - if (greatestStart.CompareTo(smallestEnd) > 0) { + if (greatestStart.CompareTo(smallestEnd) > 0 && !greatestStart.IsEmpty() && !smallestEnd.IsEmpty()) { return GDMDatePeriod.Empty; } diff --git a/projects/GKTests/GDModel/GDMLocationRecordTests.cs b/projects/GKTests/GDModel/GDMLocationRecordTests.cs index 2b1d63af8..b6e637352 100644 --- a/projects/GKTests/GDModel/GDMLocationRecordTests.cs +++ b/projects/GKTests/GDModel/GDMLocationRecordTests.cs @@ -406,6 +406,10 @@ public void Test_DateIntersections() Assert.AreEqual("FROM 1782 TO 1834", GDMCustomDate.GetIntersection(GetRange("FROM 1782"), GetRange("TO 1834")).StringValue); Assert.AreEqual("FROM 1782 TO 1834", GDMCustomDate.GetIntersection(GetRange("TO 1834"), GetRange("FROM 1782")).StringValue); + Assert.AreEqual("FROM 1782", GDMCustomDate.GetIntersection(GetRange("FROM 1782"), GetRange("FROM 1782")).StringValue); + Assert.AreEqual("FROM 1834", GDMCustomDate.GetIntersection(GetRange("FROM 1782"), GetRange("FROM 1834")).StringValue); + Assert.AreEqual("TO 1782", GDMCustomDate.GetIntersection(GetRange("TO 1782"), GetRange("TO 1782")).StringValue); + Assert.AreEqual("TO 1782", GDMCustomDate.GetIntersection(GetRange("TO 1782"), GetRange("TO 1834")).StringValue); Assert.AreEqual("", GDMCustomDate.GetIntersection(GetRange("FROM 1858"), GetRange("TO 1834")).StringValue); // no intersects Assert.AreEqual("", GDMCustomDate.GetIntersection(GetRange("TO 1834"), GetRange("FROM 1858")).StringValue); // no intersects