error time-mix
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#
fn gap(a: Time, b: LocalDateTime) -> Duration pure {
a - b // <- time-mix
}error
time-mix
How to fix#
fn gap(a: Time, b: Time) -> Duration pure {
a - b
}Convert one side so both have the same kind, then subtract or compare.