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 negative integers as durations #104

Merged
merged 1 commit into from
Sep 1, 2021

Conversation

littldr
Copy link
Contributor

@littldr littldr commented Sep 1, 2021

Hi!

the Duration getter currently allows the passed value to be an positive integer or a parsable duration string.
So that if I pass an integer like 1 I get the same results as if I would pass 1ns.

But Golang allows us to have negative duration, e.g. time.ParseDuration("-1ns").
Passing the duration string -1ns works with konaf as expected, but if I pass -1 it will return me a duration with the length of zero.

We stumbled about this unexpected behavior in this issue: ory/hydra#2651 (comment)

For consistency reasons I would propose to allow negative integers and treat them in the same way as positive ones.

What do you think?

@knadh
Copy link
Owner

knadh commented Sep 1, 2021

Yep, makes sense. Released v1.2.2 with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants