Skip to content

Commit

Permalink
fix stac query ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsumner committed Apr 9, 2024
1 parent 654fa70 commit 9290358
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/stacit.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ stacit <- function(extent, date = Sys.Date()- 1, collections = "sentinel-2-c1-l2
if (length(date) == 1L) {
if (nchar(date) == 7L && grepl("-", date)) {
date <- seq(as.Date(sprintf(c("%s-01"), date)), length.out = 2L, by = "1 month")

date[2] <- date[2] - 1
}
if (nchar(date) == 4L && !is.na(as.integer(date))) {
} else {
if (nchar(date) == 4L && !is.na(as.integer(date))) {
date <- sprintf(c("%s-01-01", "%s-12-31"), date)
}

}

date <- c(format(min(as.Date(date)), "%FT00:00:00Z"),
format(max(as.Date(date)), "%FT23:59:59Z"))
Expand Down

0 comments on commit 9290358

Please sign in to comment.