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

Need specialized diff() method for calendar / time point types #364

Open
DavisVaughan opened this issue Jan 25, 2024 · 0 comments · May be fixed by #381
Open

Need specialized diff() method for calendar / time point types #364

DavisVaughan opened this issue Jan 25, 2024 · 0 comments · May be fixed by #381
Labels
bug an unexpected problem or unintended behavior

Comments

@DavisVaughan
Copy link
Member

DavisVaughan commented Jan 25, 2024

For the size 0 case, where vctrs / base R assume you would return vec_ptype(x), but in reality you need to return an empty duration object with the right precision.

That is also a reason that diff.Date() exists.

diff(clock::year_month_day(2000, 2))
#> <year_month_day<month>[0]>

(should be duration_months(integer()))

Can probably check length and then pass on to vctrs method if long enough, also keep in mind lag and difference arguments, because they affect this too

@DavisVaughan DavisVaughan added the bug an unexpected problem or unintended behavior label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant