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

parse int value if input is of type number #72

Merged
merged 4 commits into from
Feb 23, 2024
Merged

Conversation

TeaAlex
Copy link
Contributor

@TeaAlex TeaAlex commented Feb 22, 2024

On souhaite avoir directement la valeur en int lorsque l'on reçoit la valeur d'un input type number

dans la doc de RHF il existe une props valueAsNumber dans l'api register
https://react-hook-form.com/docs/useform/register

sauf que dans notre cas on passe par les Controller et d'après cette issue valueAsNumber n'est pas dispo dans Controller

la solution simple est donc de parser la valeur au onChange

@TeaAlex TeaAlex self-assigned this Feb 22, 2024
@TeaAlex TeaAlex requested a review from aguilaj February 22, 2024 14:42
Copy link

github-actions bot commented Feb 22, 2024

size-limit report 📦

Path Size
dist/form.cjs.production.min.js 104.84 KB (+0.04% 🔺)
dist/form.esm.js 104.29 KB (+0.04% 🔺)

@TeaAlex TeaAlex merged commit 0e2265f into main Feb 23, 2024
3 checks passed
@TeaAlex TeaAlex deleted the parseIntInputNumber branch February 23, 2024 14:41
@TeaAlex TeaAlex mentioned this pull request Feb 23, 2024
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.

1 participant