Skip to content

Construct duration from record #15543

Closed

Description

@LoicRiegel

Related problem

Currently we can convert a duration to a record, but not the opposite.
Would be nice to be able to round trip $my_duration | into record | into duration

Describe the solution you'd like

Construct from records:

{week: 2, hour: 5, minute: 19, second: 45, sign: "+"} | into duration

Defaults:

  • if a field is not provided: set it to 0
  • if "sign" is not provided: set it to "+"

Round tripping works

> $my_duration | into record | into duration = $my_duration
true

Nice feedback on errors:

Describe alternatives you've considered

No response

Additional context and details

I'm on it 😄

Activity

  1. added
    category:enhancement
    status:needs-triage
    on Apr 10, 2025
  2. added
    A:datetime-handling
    and removed
    status:needs-triage
    on Apr 10, 2025
  3. modified the milestone: v0.104.0 on Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A:datetime-handlingcategory:enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions