Support negative duration inputs - #15
Merged
Merged
Conversation
Enhanced the `DurationTimeParser` to include support for negative durations in both standard and human-readable formats. By doing so the RegEx strings were extended and a bit reorganized to make their purpose clear and easy understandable. In addition, because of rounding issues, it was necessary to split up the rounding logic into separate steps. The issues cause is still not clear, but with the one-liner we ended up with nano-seconds in the result. All unit tests were extensively extended to cover negative cases, edge cases, boundary values, whitespace-padded input, case-insensitive input, and fractional unit handling - all related to negative inputs. Furthermore existing tests were restructured for an easier readability. Item: #14
Added benchmarks to cover negative duration scenarios in both standard and human-readable formats for `TryParse` and `Parse` methods. Item: #14
HaGGi13
added a commit
that referenced
this pull request
Mar 8, 2026
Enhanced the `DurationTimeParser` to include support for negative durations in both standard and human-readable formats. By doing so the RegEx strings were extended and a bit reorganized to make their purpose clear and easy understandable. In addition, because of rounding issues, it was necessary to split up the rounding logic into separate steps. The issues cause is still not clear, but with the one-liner we ended up with nano-seconds in the result. All unit tests were extensively extended to cover negative cases, edge cases, boundary values, whitespace-padded input, case-insensitive input, and fractional unit handling - all related to negative inputs. Furthermore existing tests were restructured for an easier readability. Item: #14
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.
Enhanced the
DurationTimeParserto include support for negative durations in both standard and human-readable formats.By doing so the RegEx strings were extended and a bit reorganized to make their purpose clear and easy understandable.
In addition, because of rounding issues, it was necessary to split up the rounding logic into separate steps. The issues cause is still not clear, but with the one-liner we ended up with nano-seconds in the result.
All unit tests were extensively extended to cover negative cases, edge cases, boundary values, whitespace-padded input, case-insensitive input, and fractional unit handling - all related to negative inputs.
Furthermore existing tests were restructured for an easier readability.
Item: #14