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

Add support for non-integer types with ToQuantity #722

Closed
AdamDawes opened this issue Jun 28, 2018 · 1 comment · Fixed by #801
Closed

Add support for non-integer types with ToQuantity #722

AdamDawes opened this issue Jun 28, 2018 · 1 comment · Fixed by #801

Comments

@AdamDawes
Copy link

I'm writing an application that displays numbers in the form "1 hour", "2 hours", etc. and so using the ToQuantity method looked perfect. However the number of hours in this case is not a whole number, as the application supports half-hours too. This means I can't use ToQuantity as it only supports int or long as parameter types.

Could we have additional overloads to support decimal, double etc. parameter types for this method?

@AdamDawes AdamDawes changed the title Add support for non-numeric types with ToQuantity Add support for non-integer types with ToQuantity Jun 28, 2018
@niallermoran
Copy link

I have created a simple solution for this that accepts doubles and decimals, but only supports ShowQuantityAs.Numeric, e.g. 0.2 hour will return 0.2 hours.

If this works I can submit a PR

clairernovotny pushed a commit that referenced this issue Mar 31, 2019
Fix #722 Add ToQuantity for double and tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants