OxL Reference

error time-mix

error Standard: [§17.2]

What it means#

Comparison and arithmetic between different time kinds, for example Time and ZonedTime, are errors (§17.2). A Time is an instant in UTC, a ZonedTime has a calendar and a zone, and Time plus a Period is forbidden because it has no calendar. Convert explicitly with zt.time or t.in(tz).

Example#

oxl✓ checked in CI
fn gap(a: Time, b: LocalDateTime) -> Duration  pure {
  a - b      // <- time-mix
}
error
time-mix

How to fix#

oxl✓ checked in CI
fn gap(a: Time, b: Time) -> Duration  pure {
  a - b
}

Convert one side so both have the same kind, then subtract or compare.

See also#

OxL 1.0.0-beta · Documentation version 1.0.0-beta© OxwaldLink · generated from the Standard, the std sources and the guides