Skip to content

Commit

Permalink
[Fix #664] Fix lookup of period functions in as. period
Browse files Browse the repository at this point in the history
  • Loading branch information
vspinu committed Apr 10, 2018
1 parent 6f222ba commit 4bca361
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Version 1.7.3.9000
* [#633](https://github.com/tidyverse/lubridate/issues/633) `%%` on intervals relies on `%m+` arithmetic and doesn't produce NAs when intermediate computations result in non-existent dates.
* `tz()` always returns "UTC" when `tzone` attribute cannot be inferred.

### BUG FIXES

* [#664](https://github.com/tidyverse/lubridate/issues/664) Fix lookup of period functions in `as.period`

Version 1.7.3
=============

Expand Down
4 changes: 3 additions & 1 deletion R/coercion.r
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ setMethod("as.period", signature(x = "numeric"), function(x, unit = "second", ..
x <- as.numeric(x)
if (missing(unit)) unit <- "second"
unit <- standardise_date_names(unit)
f <- match.fun(paste(unit, "s", sep = ""))
f <- get(paste(unit, "s", sep = ""),
envir = asNamespace("lubridate"),
mode = "function", inherits = FALSE)
f(x)
})

Expand Down

0 comments on commit 4bca361

Please sign in to comment.