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

as.IDate ignores origin #2880

Closed
DavidArenburg opened this issue May 15, 2018 · 2 comments
Closed

as.IDate ignores origin #2880

DavidArenburg opened this issue May 15, 2018 · 2 comments

Comments

@DavidArenburg
Copy link
Member

Searched for this in the issues but couldn't find it. It seem like as.IDate ignores origin

library(data.table) #v1.11.2
as.IDate(1000, origin = "1930-01-01")
## [1] "1972-09-27"
as.Date(1000, origin = "1930-01-01")
## [1] "1932-09-27"
@DavidArenburg
Copy link
Member Author

I've took a look in the source code and I don't see any attention to origin in as.IDate.numeric. I think we could make a small change using something like

as.IDate.numeric <- function(x, origin = "1970-01-01", ...) as.IDate(origin, ...) + x
as.IDate(1000)
## [1] "1972-09-27"
as.IDate(1000, origin = "1930-01-01")
## [1] "1932-09-27"

This also won't brake compatibility with the old behavior

@DavidArenburg DavidArenburg changed the title as.IDate ignores origin? [bug] as.IDate ignores origin? May 21, 2018
@DavidArenburg DavidArenburg changed the title [bug] as.IDate ignores origin? [bug] as.IDate ignores origin? May 21, 2018
@tdeenes
Copy link
Member

tdeenes commented May 31, 2018

Found the same bug today. @DavidArenburg , have you considered submitting a PR for this?

@mattdowle mattdowle added this to the 1.11.6 milestone Aug 17, 2018
@mattdowle mattdowle added the bug label Aug 17, 2018
@mattdowle mattdowle changed the title [bug] as.IDate ignores origin? as.IDate ignores origin Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants