diff --git a/DESCRIPTION b/DESCRIPTION index 89fbba26..34ae47f1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: rtweet Title: Collecting Twitter Data -Version: 0.7.0.9012 +Version: 0.7.0.9013 Authors@R: c(person(given = "Michael W.", family = "Kearney", diff --git a/R/statuses.R b/R/statuses.R index fd3239b8..9fe5d461 100644 --- a/R/statuses.R +++ b/R/statuses.R @@ -37,6 +37,10 @@ lookup_tweets <- function(statuses, parse = TRUE, token = NULL, if (parse) { results <- tweets_with_users(results) + locale <- Sys.getlocale("LC_TIME") + Sys.setlocale("LC_TIME", "C") + results$created_at <- as.POSIXct(results$created_at, format = "%a %b %d %T %z %Y") + Sys.setlocale("LC_TIME", locale) } results } diff --git a/R/timeline.R b/R/timeline.R index 0560ad1e..cc2cf6d6 100644 --- a/R/timeline.R +++ b/R/timeline.R @@ -66,6 +66,10 @@ get_timeline <- function(user = NULL, if (parse) { rt <- do.call("rbind", rt) rt <- as_tbl(rt) + locale <- Sys.getlocale("LC_TIME") + Sys.setlocale("LC_TIME", "C") + rt$created_at <- as.POSIXct(rt$created_at, format = "%a %b %d %T %z %Y") + Sys.setlocale("LC_TIME", locale) } rt diff --git a/tests/testthat/test-statuses.R b/tests/testthat/test-statuses.R index 55e1ed24..6eda5716 100644 --- a/tests/testthat/test-statuses.R +++ b/tests/testthat/test-statuses.R @@ -62,3 +62,8 @@ test_that("Check that geo works well, #648", { "930475046530936834", "914607458169081858")) expect_true(is.list(lu$geo) && !is.data.frame(lu$geo)) }) + +test_that("Check lookup returns appropiate format, #657", { + lu <- lookup_tweets("1488182699202383875") + expect_s3_class(lu$created_at, "POSIXct") +})