Skip to content
Open
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
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@

13. `rbindlist()` (and therefore the `rbind()` method for `data.table`s) no longer raises an error upon encountering more than approximately 50000 columns in a list entry, [#7793](https://github.com/Rdatatable/data.table/issues/7793). The bug was introduced in `data.table` version 1.18.2.1. Thanks to @rickhelmus for the report and @aitap for the fix.

14. Subtracting an `IDate` from a `Date` is fast again by avoiding unnecessary conversion to `POSIXlt`/`POSIXct`, [#7825](https://github.com/Rdatatable/data.table/issues/7825). Thanks @gilesheywood for the report and @ben-schwen for the fix.

### Notes

1. {data.table} now depends on R 3.5.0 (2018).
Expand Down
11 changes: 10 additions & 1 deletion R/IDateTime.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,16 @@ chooseOpsMethod.IDate = function(x, y, mx, my, cl, reverse) inherits(y, "Date")

`-.IDate` = function(e1, e2) {
if (!inherits(e1, "IDate")) {
if (inherits(e1, 'Date')) return(base::`-.Date`(e1, e2))
if (inherits(e1, "Date")) {
if (inherits(e2, "Date")) {
#7825 avoid base::`-.Date` to avoid conversion from IDate to POSIXlt/POSIXct
ans = unclass(e1) - unclass(e2)
setattr(ans, "class", "difftime")
setattr(ans, "units", "days")
return(ans)
}
return(base::`-.Date`(e1, e2))
}
stopf("can only subtract from \"IDate\" objects")
}
if (storage.mode(e1) != "integer")
Expand Down
Loading