Skip to content

A 'rollforward' function? #914

@kputschko

Description

@kputschko

I'm looking for a quicker way to roll a date to the end of the given month. Currently it takes two functions, ceiling_date and subtracting days.

library(lubridate)

date_1 <- ymd("2020-01-15")

# rollback is simple and great
rollback(date_1)
rollback(date_1, roll_to_first = TRUE)

# but rolling forward looks a little clunky
ceiling_date(date_1, unit = "month") - days(1)
>"2020-01-31"

# maybe add an option to rollback?
rollback(date_1, roll_to_last = TRUE)
>"2020-01-31"

# or create a new function?
rollforward(date_1)
>"2020-01-31"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions