Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fullseq() sorts range #463

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

teunbrand
Copy link
Contributor

This PR aims to fix #435.

Briefly, fullseq() now sorts the input range before doing the calculation. This prevents errors about the sign of the by argument.

Comment on lines -20 to -21
x <- as.Date("2012-01-01") + 1:30
expect_equal(fullseq(x, "1 month"), as.Date(c("2012-01-01", "2012-02-01")))
Copy link
Contributor Author

@teunbrand teunbrand Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was wonky. fullseq() only considers range[1] and range[2], but this is a vector of 30 dates instead of a range of 2 dates.

In addition, ceiling_date("2012-01-01", "1 month") gives 1st of March because 31 days from the end of January is in March due to February typically having only 28 days. I consider this out of scope for this PR, but it isn't doing any real harm anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

breaks_width() does not work with reverse transform
1 participant