Skip to contents

Temporal's total(): the whole duration as a possibly fractional count of unit. Years, months and weeks need relative_to; without it a day counts 24 hours.

Usage

temporal_total(x, unit, relative_to = NULL)

# S3 method for class 'zutempo_duration'
temporal_total(x, unit, relative_to = NULL)

Arguments

x

A duration().

unit

A Temporal unit, singular or plural.

relative_to

A plain_date(), plain_date_time(), zoned_date_time() or a string one of them reads (a zone in brackets makes it zoned); with a zoned value, days follow the zone.

Value

A double vector.

Examples

temporal_total(duration(hours = 25), "day")
#> [1] 1.041667
temporal_total(duration(months = 1), "day", relative_to = "2026-02-01")
#> [1] 28