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.
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
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.(should be
duration_months(integer())
)Can probably check length and then pass on to vctrs method if long enough, also keep in mind
lag
anddifference
arguments, because they affect this too