Skip to content

Commit

Permalink
Merge pull request #289 from JBleher/master
Browse files Browse the repository at this point in the history
Subday intervals enabled
  • Loading branch information
PMassicotte authored Sep 21, 2018
2 parents 99f8041 + 5be76d2 commit 1113a6e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
15 changes: 10 additions & 5 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ check_time <- function(time) {
return(FALSE)
}

start_date <- anytime::anydate(time[1])
end_date <- anytime::anydate(time[2])
if(!grepl("T",time[1])){
start_date <- as.POSIXct(anytime::anydate(time[1]))
end_date <- as.POSIXct(anytime::anydate(time[2]))
}else{
start_date <- anytime::anytime(time[1])
end_date <- anytime::anytime(time[2])
}

if (is.na(start_date) | is.na(end_date)) {
return(FALSE)
Expand All @@ -57,13 +62,13 @@ check_time <- function(time) {
return(FALSE)
}

## Start date can't be before 204-01-01
if (start_date < as.Date("2004-01-01")) {
## Start date can't be before 2004-01-01
if (start_date < as.POSIXct("2004-01-01")) {
return(FALSE)
}

## End date can't be after today
if (end_date > Sys.Date()) {
if (end_date > as.POSIXct(Sys.Date())) {
return(FALSE)
}

Expand Down
28 changes: 23 additions & 5 deletions man/gtrends.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1113a6e

Please sign in to comment.