Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions r/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* `tz()` to extract/get timezone
* `semester()` to extract/get semester
* `dst()` to get daylight savings time indicator.
* `epiyear()` to get epiyear

# arrow 7.0.0

Expand Down
1 change: 1 addition & 0 deletions r/R/expression.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"isoweek" = "iso_week",
"epiweek" = "us_week",
"isoyear" = "iso_year",
"epiyear" = "us_year",
"minute" = "minute",
"quarter" = "quarter",
# second is defined in dplyr-functions.R
Expand Down
18 changes: 18 additions & 0 deletions r/tests/testthat/test-dplyr-funcs-datetime.R
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,15 @@ test_that("extract isoyear from timestamp", {
)
})

test_that("extract epiyear from timestamp", {
compare_dplyr_binding(
.input %>%
mutate(x = epiyear(datetime)) %>%
collect(),
test_df
)
})

test_that("extract quarter from timestamp", {
compare_dplyr_binding(
.input %>%
Expand Down Expand Up @@ -511,6 +520,15 @@ test_that("extract isoyear from date", {
)
})

test_that("extract epiyear from date", {
compare_dplyr_binding(
.input %>%
mutate(x = epiyear(date)) %>%
collect(),
test_df
)
})

test_that("extract quarter from date", {
compare_dplyr_binding(
.input %>%
Expand Down