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

fix: IsNumber cannot check for zero decimal places #523

Closed
tmtron opened this issue Feb 12, 2020 · 2 comments
Closed

fix: IsNumber cannot check for zero decimal places #523

tmtron opened this issue Feb 12, 2020 · 2 comments
Labels
status: done/released Issue has been completed, no further action is needed. type: fix Issues describing a broken feature.

Comments

@tmtron
Copy link
Contributor

tmtron commented Feb 12, 2020

checking for zero decimal places does not work:

    class ZeroDecimalPlacesTest {
        @IsNumber({ maxDecimalPlaces: 0 })
        someProperty: number;
    }

The following validation logic is wrong:

if (options.maxDecimalPlaces) {

instead it should check if maxDecimalPlaces is undefined:

if (options.maxDecimalPlaces !== undefined) {
tmtron added a commit to tmtron/class-validator that referenced this issue Feb 12, 2020
@vlapo vlapo added the type: fix Issues describing a broken feature. label Mar 16, 2020
tmtron added a commit to tmtron/class-validator that referenced this issue Mar 17, 2020
tmtron added a commit to tmtron/class-validator that referenced this issue Mar 17, 2020
@vlapo
Copy link
Contributor

vlapo commented Mar 18, 2020

Closed by #524

@vlapo vlapo closed this as completed Mar 18, 2020
@lock
Copy link

lock bot commented Mar 27, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Mar 27, 2020
@NoNameProvided NoNameProvided changed the title IsNumber cannot check for zero decimal places fix: IsNumber cannot check for zero decimal places Aug 8, 2020
@NoNameProvided NoNameProvided added the status: done/released Issue has been completed, no further action is needed. label Aug 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: done/released Issue has been completed, no further action is needed. type: fix Issues describing a broken feature.
Development

No branches or pull requests

3 participants