Skip to content

Commit

Permalink
fixed datetime formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bossie committed May 24, 2023
1 parent 9cc478a commit d388f15
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import geotrellis.vector.{Extent, ProjectedExtent}

import java.net.URL
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter.ISO_DATE_TIME
import java.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME
import scala.collection.Map

/**
Expand Down Expand Up @@ -60,7 +60,9 @@ class STACClient(private val endpoint: URL = new URL("https://earth-search.aws.e
.param("page", page.toString)

val getProductsForDateRange = dateRange.foldLeft(getProducts) { case (req, (fromDate, toDate)) =>
req.param("datetime", s"${fromDate format ISO_DATE_TIME}/${toDate format ISO_DATE_TIME}")
// requires offsets, not time zones according to
// https://github.com/radiantearth/stac-api-spec/tree/main/item-search#query-parameter-table
req.param("datetime", s"${fromDate format ISO_OFFSET_DATE_TIME}/${toDate format ISO_OFFSET_DATE_TIME}")
}

val json = withRetries {
Expand Down

0 comments on commit d388f15

Please sign in to comment.