Open AshesITR opened 1 year ago
Here is a more general fix, covering base operations and summaries (like sum, min, max, range), and mean() I can work on a PR if the change is desired.
Ops.hms <- function(e1, e2) {
res <- NextMethod(.Generic)
if (inherits(res, "difftime")) {
hms::as_hms(res)
} else {
res
}
}
Summary.hms <- function(..., na.rm) {
res <- NextMethod(.Generic)
hms::as_hms(res)
}
mean.hms <- function(x, ...) {
hms::as_hms(NextMethod(.Generic))
}
Thanks. Is this related to #18?
Trying to understand the neccessary test cases:
Relevant classes appear to be all of: Date
, POSIXct
and POSIXlt
(possibly with timezones and times around DST), difftime
(base), hms
.
Once with hms
on the LHS and once with hms
on the RHS (with expect_error()
where appropriate).
Is that assessment correct?
Multiplying with and dividing by numeric or integer? Otherwise, this looks fairly complete.
Most computations with
hms
drop the class todifftime
causing worse UX.Created on 2023-08-18 with reprex v2.0.2