Skip to content

Strange %m+% error seemingly only on Linux #1191

@arunsrinivasan

Description

@arunsrinivasan

I recently updated lubridate from 1.7.4 to 1.9.4. On Windows, there seems to be no particular issue. But on Cent OS Linux 7 (R 3.6.0), this particular date errors. Even then, it doesn't error on Date class but (AFAICT) only on IDate. E.g., 2023-04-01 works fine on both OS with IDate too. All dates worked fine in the previous lubridate version I used. So I figure this must be a bug? There might be other dates where it errors but this was the first date where my code returned error on Linux but not on Windows (running same R version 3.6.0).

require(lubridate)  # v1.9.4
require(data.table) # 1.13.2

d1 = ymd("2023-03-31")
d2 = as.IDate(d1)

# Windows
d1 %m+% months(3) # [1] "2023-06-30"
d2 %m+% months(3) # [1] "2023-06-30"

# Cent OS Linux 7 with R 3.6.0
d1 %m+% months(3) # [1] "2023-06-30"
d2 %m+% months(3) # Error: Incompatible classes: <IDate> - <Period>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions