diff --git a/src/commonTest/kotlin/org/reactome/lit_ball/util/DateMatcher.kt b/src/commonTest/kotlin/org/reactome/lit_ball/util/DateMatcher.kt index 5bc6c59..f3ed7dc 100644 --- a/src/commonTest/kotlin/org/reactome/lit_ball/util/DateMatcher.kt +++ b/src/commonTest/kotlin/org/reactome/lit_ball/util/DateMatcher.kt @@ -12,6 +12,7 @@ class DateMatcherTest { companion object { val testData = listOf( TestData("", "2002", true), + TestData("", "2002-01-04", true), TestData("2002", "2002", true), TestData("2000-2004", "2002", true), TestData("1999", "2002", false), diff --git a/src/main/kotlin/org/reactome/lit_ball/util/Utils.kt b/src/main/kotlin/org/reactome/lit_ball/util/Utils.kt index fb84f56..e958ae3 100644 --- a/src/main/kotlin/org/reactome/lit_ball/util/Utils.kt +++ b/src/main/kotlin/org/reactome/lit_ball/util/Utils.kt @@ -97,7 +97,9 @@ class DateMatcher(filteredDate: String?) { fun matches(publicationDate: String?): Boolean { if (!initialized) return false + if (fromYear == -infinity && toYear == infinity) return true publicationDate?.let { pDate -> + if (pDate.isBlank()) return true if (pDate.length < 4 || pDate.any { !it.isDigit() }) return false val pYear = pDate.slice(0..3).toInt()