monday <- interval(as.Date("2025-11-10"), as.Date("2025-11-11"))
friday <- interval(as.Date("2025-11-14"), as.Date("2025-11-15"))
phint_length(monday)
phint_length(phint_intersect(monday, friday))
# phint_length() sums the lengths of disjoint time spans
mon_and_fri <- phint_union(monday, friday)
phint_length(mon_and_fri) == phint_length(monday) + phint_length(friday)
# phint_lengths() returns the length of each disjoint time span
phint_lengths(mon_and_fri)
Run the code above in your browser using DataLab