clock 0.7.0
New features
-
New
year_week_day()calendar for specifying a date using the year, the week
number, and the day of the week, alongside astartvalue representing the
day of the week that is considered the start of the week. Using
start = clock_weekdays$mondayis identical to theiso_year_week_day()
calendar, and usingstart = clock_weekdays$sundayis useful for representing
the Epidemiological calendar used by the US CDC guidelines (similar to what
is supported bylubridate::epiweek()andlubridate::epiyear()) (#110). -
New
date_spanning_seq()for generating a regular sequence along the full
span of a date or date-time vector (i.e. along[min(x), max(x)]). It is
similar totidyr::full_seq(), but is a bit simpler and currently has better
handling of some edge cases. Additionally included in the low-level API are
calendar_spanning_seq(),time_point_spanning_seq(), and
duration_spanning_seq()(#279). -
New
date_time_info()andzoned_time_info()low-level helpers for accessing
the previous/next transition times, the offset from UTC, and the current time
zone abbreviation (#295). -
calendar_leap_year()now supports the year-quarter-day and iso-year-week-day
calendars (#332, #333).
Breaking changes
-
The storage mechanism for the duration, sys-time, naive-time, and zoned-time
types has been altered to more correctly represent the full range of values
allowed by the underlying C++ types. This means that if you have serialized
a value of one of these types with an old version of clock, then it will no
longer unserialize correctly going forward.Technically, rather than storing a variable number of integer vectors
representing ticks, ticks of a day, and ticks of a second, we now always store
values of these types within two double vectors, regardless of the precision.
This simplifies the implementation and allows us to represent the full range
of possibleint64_tvalues (#331).
Lifecycle changes
date_zone()anddate_set_zone()have been soft-deprecated in favor of
date_time_zone()anddate_time_set_zone()(#326).
Minor changes and bug fixes
-
clock now compiles significantly faster (on a 2018 Intel Mac, it used to take
~70 seconds for a full compilation, and now takes ~25 seconds) (#322). -
%%and%/%operators now return a missing value when the right-hand side
is0. For%/%, this is consistent with2L %/% 0L, which returns a
missing value, rather than with2 %/% 0, which returnsInf, since
infinite durations are not supported (#349). -
seq()methods for durations and time points handle the empty sequence cases
offrom > to && by > 0andfrom < to && by < 0better whenfromandto
are very far apart (i.e. when they would otherwise result in overflow if they
were subtracted). -
zoned_time_zone()andzoned_time_set_zone()are no longer generic, and now
only work for zoned-times. -
Documented clock's current stance on leap seconds in the FAQ vignette (clock
ignores them like POSIXct) (#309). -
Duration vectors now work as
.beforeand.afterarguments of
slider::slide_index()and friends (#306). -
All
as_*()generics exported by clock now include...in their signature
to help with extensibility of converting to clock types. These are the only
clock generics that are currently "blessed" as fully extensible (#348). -
as.character()has been implemented for durations. -
Fixed
vec_ptype_full()andvec_ptype_abbr()methods for sys-time and
naive-time objects (#302). -
Renamed
locale.htofill.hto avoid clock'slocale.hbeing chosen over a
system header of the same name on some CentOS machines (#310). -
Skipped a test on 32-bit architectures to work around a bug in base R (#312).
-
R >=3.5.0 is now required, which is in line with tidyverse standards.
-
vctrs >=0.6.1 and rlang >=1.1.0 are now required.