dragosmg commented on a change in pull request #12433: URL: https://github.com/apache/arrow/pull/12433#discussion_r813912419
########## File path: r/tests/testthat/test-dplyr-funcs-datetime.R ########## @@ -801,3 +801,85 @@ test_that("dst extracts daylight savings time correctly", { test_df ) }) + +test_that("date works in arrow", { + # https://issues.apache.org/jira/browse/ARROW-13168 + skip_on_os("windows") + # this date is specific since lubridate::date() is different from base::as.Date() + # since as.Date returns the UTC date and date() doesn't + test_df <- tibble( + a = as.POSIXct(c("2012-03-26 23:12:13", NA), tz = "America/New_York")) + + # we can't (for now) use namespacing, so we need to make sure lubridate::date() + # and not base::date() is being used + # TODO remove once https://issues.apache.org/jira/browse/ARROW-14575 is done + date <- lubridate::date + compare_dplyr_binding( + .input %>% + mutate(a_date = date(a)) %>% + collect(), + test_df + ) + + compare_dplyr_binding( + .input %>% + mutate(a_date_base = as.Date(a)) %>% + collect(), + test_df + ) + + r_date_object <- lubridate::ymd_hms("2012-03-26 23:12:13") + compare_dplyr_binding( + .input %>% + mutate(b = date(r_date_object)) %>% + collect(), + test_df + ) + + compare_dplyr_binding( + .input %>% + mutate(b_base = as.Date(r_date_object)) %>% + collect(), + test_df + ) + Review comment: Do we want to remove all the tests below this point? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org