Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow parse_duration function to parse multiple duration similar to Golang's time.ParseDuration #1196

Closed
titaneric opened this issue Dec 27, 2024 · 0 comments · Fixed by #1197
Labels
type: feature A value-adding code addition that introduce new functionality. vrl: stdlib Changes to the standard library

Comments

@titaneric
Copy link
Contributor

titaneric commented Dec 27, 2024

Hi, I would like to add the feature for VRL, which is allow parse_duration function to parse give string with multiple units such as 1h1s, and 3s3ms and so on similar to golang's time.ParseDuration.

Basically, golang's implementation parse given string until finding the duration unit, and keeps finding next digit unit match next duration unit. So, space is not allowed in the given duration string in golang. But since space is already allowed in VRL's parse_duraiton. I think space could be added for multiple-units duration string.
However, golang's implementation allows sign for given duration string. Whether we should add the support for signed duration deserves another issue opened.

@pront pront added vrl: stdlib Changes to the standard library type: feature A value-adding code addition that introduce new functionality. labels Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A value-adding code addition that introduce new functionality. vrl: stdlib Changes to the standard library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants