Skip to contents

mixtime 0.2.0

New features

  • Added support for multiplication and division of time durations.
  • Added round()/floor()/ceiling() methods for rounding time by chronons. (note: use time_round(), time_floor(), and time_ceiling() for rounding to a specified time granule).
  • Added casting from time durations to character vectors.
  • Added explicit conversion to naive time by using tz = NA.

Improvements

  • time_unit_full() now uses cli-style pluralisation templates (e.g., "year{?/s}", "centur{?y/ies}"), enabling accurate plural forms beyond a simple s suffix. A new time_unit_plural(x, n) helper resolves the template for a given quantity.
  • Continuous time model durations now always show at least one decimal place.
  • Added formatting support for NaN, Inf, and -Inf values in time types.
  • Added time zone support for arithmetic.
  • Time durations now use the same formatting system and format strings as linear and cyclical time.
  • Improved str() output to be more compact for each time type.

Bug fixes

  • Fixed incorrect usage of time_chronon() causing arithmetic to fail.
  • Fixed incompatibilities with vctrs sorting, ptype2, and casting methods.
  • Fixed formatting of cyclical time with mixed-calendar chronon and cycle (#62).
  • Fixed divmod of Gregorian day -> month and day -> year producing incorrect divisors near the year boundary for continuous time dates.
  • Fixed c() allowing non-time vectors in mixtime vectors.

mixtime 0.1.0

CRAN release: 2026-05-19

This is the initial CRAN release of the package with provides the core data types and temporal manipulation for temporal analysis with mixed granularity data.

New features

Time

  • The generic mixtime() constructor for creating mixed temporal vectors that combine time points of different granularities (e.g. monthly and quarterly) in a single vector via vecvec.

Linear time

Cyclical time

Calendar systems

  • Three initial calendar systems:
    • cal_gregorian: standard Gregorian calendar with year, quarter, month, day, hour, minute, second, and millisecond units.
    • cal_isoweek: ISO 8601 week-date calendar with ISO year, week, and day units. Weeks always start on Monday; the first week of the year is the week containing the first Thursday.
    • cal_sym454: Symmetry454 perennial solar calendar with a symmetrical 4–5–4 week pattern per quarter and a leap-week rule.

Sequences

  • seq() methods for mixtime and mt_time objects support integer, string (e.g. "1 month"), and time unit by arguments, as well as length.out and along.with. Overflow behaviour when step granules differ from sequence granules can be controlled with on_invalid = "nearest" (default) or "overflow".

Rounding

  • round_time(), floor_time(), and ceiling_time() round time objects to a specified time granule, preserving the input class and timezone.

Formatting

  • A mixed-calendar general purpose formatting system is provided for mixtime objects. The format strings use glue-like {} substitutions with the helper functions lin(x) and cyc(x, y) to position linear and cyclical time components in a string. x and y are time granules from a calendar, which can be used to create general purpose mixed-calendar time formats.

Timezone support

  • tz_name() extracts the timezone from a time object.
  • tz_offset() returns the UTC offset for a datetime in its timezone.
  • tz_abbreviation() returns the timezone abbreviation (e.g. "EST", "PDT").
  • tz_transitions() returns a data frame of DST and other timezone transitions between two time points.

Accessor functions

tsibble and fable compatibility

  • Methods for tsibble index validation are provided, enabling mixtime vectors to be used as time indexes in tsibble objects and in forecasting with fable.

Extensibility

Vignettes

  • Extending mixtime - a vignette on how to define new calendars and implement calendar arithmetic for temporal operations within the calendar’s units and with other calendars.