datey 0.2.0
Breaking changes
-
Switched the interval convention for
datey_intervalfrom left-closed, right-open[start, end)to left-open, right-closed(start, end]for consistency with survival analysis and actuarial exposed-to-risk, for which a period ending in death should include the time of death.This means
interval %includes% tis nowTRUEwhenstart < t <= endand so code that tests membership at an interval’s start or end will produce different results. In particular,datey(valid_years_start)is no longer included inall_of_timebutdatey(valid_years_end)is. A
datey_intervalis now formatted and printed as(start, end].
datey 0.1.2
CRAN release: 2026-09-16
- Added
rep()methods fordatey,durationyanddatey_interval. Previouslyrep()dropped the class and returned bare integer or double values. Asrep_len()andrep.int()fall back torep()dispatch, they are fixed too. This also fixespmax()andpmin(), which previously returned the wrong values fordateyanddurationywhen arguments of different lengths were recycled.
datey 0.1.1
CRAN release: 2026-07-14
- Fixed undefined behaviour (negation of
NA_INTEGER) when parsingdurationyfrom text in C++. Results are unaffected on conforming hardware.
datey 0.1.0
CRAN release: 2026-07-07
Initial CRAN release.
-
dateyanddurationyrepresent dates and durations on a discrete annual grid, with exact, associative arithmetic (+,-, comparisons,mean(),range(), etc.). -
start_day(),mid_day(),end_day()anddatey()map calendar year/month/day (and day-fraction), fractional years andDate,POSIXct,POSIXlttodatey. -
to_ymdf()and$year,$month,$dayand$day_fractionprovide the breakdown of adateyinto year, month, day and day fraction components. -
is_start_day()andis_mid_day()provides checking ofdateyalignment. -
as.double()andas.integer()provide convenient conversion to numeric types as years, with mixed number anddatey/durationyarithmetic adhering to the same convention using implicit conversion. -
NA_datey_,NA_durationy_andNA_datey_interval_provide type-correctNAs, with fullis.na()/anyNA()support. - Text parsing and formatting for
datey,durationyanddatey_interval. -
pillar_shaft()methods for readable printing ofdatey/durationy/datey_intervalcolumns in tibbles. -
is_leap_year()for integer years anddateys. -
datey_interval(constructed withdatey_interval()or%to%) represents a half-open[start, end)date interval. Operations include:-
==and!=for equality comparison. -
%includes%(orinterval_includes()) to test whether an interval contains adateyor numeric value. -
&for intersection: returns an empty collapsed interval for adjacent intervals,NA_datey_interval_for non-intersecting non-adjacent intervals. -
is_collapsed(),is_proper()and related predicates. - Constants
all_of_timeandNA_datey_interval_.
-
-
seq()is supported fordateyanddurationyvia abyargument (note:length.outis not supported).