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: Prevent negative age input values in New Patient form, along wit… #1380

Merged
merged 3 commits into from
Jan 9, 2025

Conversation

harshitg927
Copy link
Contributor

…h some formatting of frontend code

fixes - issue#1375

Summary

  • Added validation to handleYearsChange function to prevent negative values
  • Ensures age input cannot be less than 0
  • Updates patient details state with validated non-negative value
  • Maintains correct DOB calculation with validated age

Screenshots

Screencast.from.09-01-25.00.48.06.webm

Related Issue

#1375

@harshitg927
Copy link
Contributor Author

@Lemeri123 I have fixed the issue, please review my Pull Request

@Lemeri123
Copy link

The issue still persists when one enters a value like -1 and above. @mozzy11 please help us look into the context of this issue. It basically doesnt affect operation but just for purposes of perfection and having a smooth usage

@harshitg927
Copy link
Contributor Author

@Lemeri123 I have put const years = Math.max(0, Number(e.target.value)); in the code which makes the input age default to zero if the user inputs a negative value.

@mozzy11 mozzy11 merged commit e0a6881 into I-TECH-UW:develop Jan 9, 2025
4 checks passed
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.

3 participants