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

Use explicit integers in year() and month() #1103

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

malcolmbarrett
Copy link

An astute student pointed out to use that day(), year() and month() are inconsistent in their return types:

library(lubridate)
x <- ymd("2012-03-26")
is.integer(month(x))
#> [1] FALSE
is.integer(day(x))
#> [1] TRUE
is.integer(year(x))
#> [1] FALSE

Created on 2022-12-15 with reprex v2.0.2

This seems like an unintentional conversion due to addition. This PR uses explicit integer addition to have month() and year() return integers

@vspinu
Copy link
Member

vspinu commented Dec 19, 2022

This has been attempted before The consequences are not as benign as they might appear.

Let's try to give it another try, but not for the forthcoming release (end of this month) but for the next one. leaving this open till then.

@malcolmbarrett
Copy link
Author

Sounds good. Happy to help with revdep fallout when the time comes. Just let me know

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.

2 participants