Skip to content

Fix parsing of zero duration with units - #202

Merged
inhere merged 1 commit into
gookit:masterfrom
graineri:fix/201/zero-duration-unit
Sep 18, 2025
Merged

inhere merged 1 commit into
gookit:masterfrom
graineri:fix/201/zero-duration-unit

Conversation

@graineri

Copy link
Copy Markdown
Contributor

Fixes issue #201.

@inhere
inhere requested a review from Copilot September 18, 2025 01:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fixes parsing of zero duration values with units by updating the condition in ValDecodeHookFunc to include strings starting with '0'. This addresses issue #201 where zero durations like "0s", "0m", etc. were not being parsed correctly.

  • Modified condition from str[0] > '0' to str[0] >= '0' to include zero values
  • Added comprehensive test coverage for various zero duration formats

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
util.go Changed condition to include '0' character in duration parsing logic
issues_test.go Added regression test covering zero duration parsing for all common time units

@inhere inhere added the bug_fix label Sep 18, 2025
@inhere
inhere merged commit 5b631cd into gookit:master Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants