Skip to content

Construct duration from record #15543

@LoicRiegel

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 😄

Metadata

Metadata

Assignees

Labels

A:datetime-handlingSemantics and implementation of the datetime/duration types and commandscategory:enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions