Unverified Commit 84fc3983 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

process dates like 1950-01-01/1950-02-12


Signed-off-by: Sebastian Schüpbach's avatarSebastian Schüpbach <sebastian.schuepbach@unibas.ch>
parent 77e678cd
Pipeline #21229 passed with stages
in 5 minutes and 44 seconds
......@@ -207,6 +207,7 @@ class Manifest {
private lazy val onlyYear = "^(\\d{4})$".r
private lazy val date = "^(\\d{4}-\\d{2}-\\d{2})$".r
private lazy val yearRange = "^(\\d{4}/\\d{4})$".r
private lazy val dateRange = "^(\\d{4}-\\d{2}-\\d{2}/\\d{4}-\\d{2}-\\d{2})$".r
private lazy val untilYear = "^(\\?/\\d{4})$".r
private lazy val fromYear = "^(\\d{4}/\\?)$".r
......@@ -227,7 +228,7 @@ class Manifest {
parseTimestamp(LocalDate.parse(s"$value-01-01", dateTimeFormatter))
case yearRange(value) =>
val dateRangeStart = value.split("/")(0)
val dateRangeEnd = value.split("/")(0)
val dateRangeEnd = value.split("/")(1)
parseTimestamp(
LocalDate.parse(s"${value.split("/")(0)}-01-01", dateTimeFormatter)
) match {
......@@ -240,6 +241,21 @@ class Manifest {
)
case der @ _ => der
}
case dateRange(value) =>
val dateRangeStart = value.split("/")(0)
val dateRangeEnd = value.split("/")(1)
parseTimestamp(
LocalDate.parse(dateRangeStart, dateTimeFormatter)
) match {
case der @ DateExtractionResult(Some(_), _, None) =>
der.copy(metadata =
List(
("Date range start", dateRangeStart),
("Date range end", dateRangeEnd)
)
)
case der @ _ => der
}
case fromYear(value) =>
val dateRangeStart = value.split("/")(0)
parseTimestamp(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment