Skip to content

Equal to == operator doesn't work as expected with lubridate intervals #1135

@jakemanger

Description

@jakemanger

If you attempt to use an == check with lubridate intervals, it uses the interval duration, rather than the interval object itself.

Reading the docs for lubridate::interval, this doesn't seem like this should be the default behaviour. Shouldn't this act like comparing two time ranges?

library(lubridate)
> interval(start=ymd('2018-01-01'), end=ymd('2018-01-02')) == interval(start=ymd('2018-01-02'), end=ymd('2018-01-02')) 
[1] FALSE
> interval(start=ymd('2018-01-01'), end=ymd('2018-01-02')) == interval(start=ymd('2018-01-03'), end=ymd('2018-01-04')) 
[1] TRUE

Note, I am using lubridate 1.9.2

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