Skip to content

Commit

Permalink
[Fix #543] Make wday work on character inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
vspinu committed Oct 3, 2017
1 parent e4ad2c3 commit 5bce161
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Version 1.6.0.9000

### BUG FIXES

* [#543](https://github.com/tidyverse/lubridate/issues/543) Make `wday` work on character inputs as it is the case with all other day accessors.
* [#566](https://github.com/tidyverse/lubridate/issues/566) Comparing durations and periods no-longer infloops.
* [#556](https://github.com/tidyverse/lubridate/issues/556) Fix incorrect scoring of `y` format when it's the last in format order (as in `mdy`).
* [#559](https://github.com/tidyverse/lubridate/issues/559) Parsing of alpha-months in English locales now drops correctly to low level C parsing. Thus, parsing with multiple orders containing `m` and `b` formats now works correctly.
Expand Down
1 change: 1 addition & 0 deletions R/accessors-day.r
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ qday <- function(x)

#' @export
qday.default <- function(x) {
x <- as_date(x)
as.integer(x - floor_date(x, "quarter")) + 1
}

Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/test-accessors.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ test_that("empty argument date() works", {
expect_silent(date())
})

test_that("day accessors work on character inputs", {
x <- "2017-05-07 GMT"
d <- ymd(x)
expect_equal(wday(x), wday(d))
expect_equal(mday(x), mday(d))
expect_equal(qday(x), qday(d))
expect_equal(yday(x), yday(d))
})

test_that("wday works with various start values", {

days <- days2 <-
Expand Down

0 comments on commit 5bce161

Please # to comment.