OxL Справочник OxL
РусскийEnglish

error time-mix

error Стандарт: [§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✓ проверяется в CI
fn gap(a: Time, b: LocalDateTime) -> Duration  pure {
  a - b      // <- time-mix
}
error
time-mix

How to fix#

oxl✓ проверяется в 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 · Версия документации 1.0.0-beta© OxwaldLink · сгенерировано из Стандарта, исходников std и руководства