feat: parse ISO 8601 durations#280
Closed
bernot-dev wants to merge 1 commit into
Closed
Conversation
Signed-off-by: Adam Bernot <bernot@google.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #280 +/- ##
==========================================
+ Coverage 86.51% 87.02% +0.50%
==========================================
Files 18 19 +1
Lines 2469 2589 +120
==========================================
+ Hits 2136 2253 +117
- Misses 230 232 +2
- Partials 103 104 +1 ☔ View full report in Codecov by Harness. |
Closed
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change type
🆕 New feature or enhancement
Short description
Support parsing ISO 8601 duration strings in
ParseDuration.Fixes
Full description
This change adds native support for parsing ISO 8601 durations within the
ParseDurationfunction. It implements a dedicated, zero-allocation parser (ParseISO8601Durationiniso8601_duration.go) that handles all standard ISO 8601 duration designators (years, months, weeks, days, hours, minutes, and seconds), along with positive/negative signs and decimal fraction separators (supporting both dots and commas). By integrating this check into the mainParseDurationentry point, any incoming strings that begin with thePprefix (after trimming spaces and signs) are routed through the ISO 8601 parser. Comprehensive test suites have been introduced iniso8601_duration_test.goandduration_test.goto cover edge cases, validation rules, overflow boundaries, and format correctness.Checklist