Skip to content

<duration> mod <duration> gives duration, but said to be float #13298

@YDX-2147483647

Description

@YDX-2147483647

Describe the bug

<duration> mod <duration> gives another duration, but the type checker thinks it's a float.

How to reproduce

> 92sec mod 1min
32sec
> 92sec mod 1min | describe
duration
> 32sec / 1sec 
32

But…

> (92sec mod 1min) / 1sec
Error: nu::parser::unsupported_operation

  × division is not supported between float and duration.
   ╭─[entry #6:1:1]
 1 │ (92sec mod 1min) / 1sec
   · ────────┬─────── ┬ ──┬─
   ·         │        │   ╰── duration
   ·         │        ╰── doesn't support these values
   ·         ╰── float
   ╰────

Expected behavior

> (92sec mod 1min) / 1sec
32

Screenshots

Configuration

key value
version 0.93.0
major 0
minor 93
patch 0
branch
commit_hash ca5ee3d
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.77.2 (25ef9e3d8 2024-04-09)
rust_channel 1.77.2-x86_64-pc-windows-msvc
cargo_version cargo 1.77.2 (e52e36006 2024-03-26)
build_time 2024-05-01 12:53:36 -07:00
build_rust_channel release
allocator mimalloc
features dataframe, default, sqlite, system-clipboard, trash, which
installed_plugins

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-triageAn issue that hasn't had any proper look

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions