Skip to content

Commit

Permalink
preserve behaviour when start and end date are equal
Browse files Browse the repository at this point in the history
  • Loading branch information
jdries committed Aug 23, 2023
1 parent afb33ea commit 2df5849
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/scala/org/openeo/opensearch/OpenSearchClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import scalaj.http.{Http, HttpOptions, HttpRequest}
import java.io.IOException
import java.net.URL
import java.time.ZoneOffset.UTC
import java.time.{LocalDate, ZonedDateTime}
import java.time.{LocalDate, OffsetTime, ZonedDateTime}
import java.util
import java.util.concurrent.atomic.AtomicLong
import scala.collection.Map
Expand Down Expand Up @@ -85,7 +85,12 @@ abstract class OpenSearchClient {
processingLevel: String): Seq[Feature] = {

val start = dateRange._1.atStartOfDay(UTC)
val end = dateRange._2.atStartOfDay(UTC)
val end = if(dateRange._1 isEqual dateRange._2) {
val endOfDay = OffsetTime.of(23, 59, 59, 999999999, UTC)
dateRange._2.atTime(endOfDay).toZonedDateTime
} else {
dateRange._2.atStartOfDay(UTC)
}

getProducts(collectionId, Some((start, end)), bbox, attributeValues, correlationId = correlationId, processingLevel)
}
Expand Down

0 comments on commit 2df5849

Please sign in to comment.