-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Construct duration from record #15543
Copy link
Copy link
Closed
Labels
A:datetime-handlingSemantics and implementation of the datetime/duration types and commandsSemantics and implementation of the datetime/duration types and commandscategory:enhancementNew feature or requestNew feature or request
Milestone
Description
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 durationDefaults:
- 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
trueNice feedback on errors:
- field has invalid type
- parsing error
- ... (see examples in PR Feat: construct datetime from record #15455)
Describe alternatives you've considered
No response
Additional context and details
I'm on it 😄
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:datetime-handlingSemantics and implementation of the datetime/duration types and commandsSemantics and implementation of the datetime/duration types and commandscategory:enhancementNew feature or requestNew feature or request