Skip to content

leap_year() not working for a new class "yearmonth" #703

@earowang

Description

@earowang

There's a new class "yearmonth" from the tsibble package. Its underlying class is Date. year() works for it but leap_year() doesn't. This is due to recognize() is too strict using all(). Can we use any() instead? I'm happy to give a pull request too. Thanks.

library(lubridate)
#> 
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#> 
#>     date
x <- tsibble::yearmonth(Sys.Date())
x
#> [1] "2018 Aug"
class(x)
#> [1] "yearmonth" "Date"
leap_year(x)
#> Error in leap_year(x): unrecognized date format
year(x)
#> [1] 2018

Created on 2018-08-07 by the reprex
package
(v0.2.0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorwipwork in progress

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions