Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

feat(patients): max DOB set for current date #1985

Closed
wants to merge 10 commits into from

Conversation

jlato89
Copy link

@jlato89 jlato89 commented Apr 14, 2020

Added maxDate prop to DatePicker component to avoid DOB being set in the future.

Fixes #1984.

Changes proposed in this pull request:

  • Added maxDate prop to DatePickerWithLabelFormGroup component to restrict DOB from being set in the future.

Newly added dependencies with Bundlephobia links:

  • No new dependencies

Added maxDate prop to DatePicker component to avoid DOB being set in the future.
@jsf-clabot
Copy link

jsf-clabot commented Apr 14, 2020

CLA assistant check
All committers have signed the CLA.

@vercel
Copy link

vercel bot commented Apr 14, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/hospitalrun/hospitalrun-frontend/nrs0sriwn
✅ Preview: https://hospitalrun-frontend-git-fork-jlato89-master.hospitalrun.now.sh

@jlato89
Copy link
Author

jlato89 commented Apr 14, 2020

This also partially Fixes #1976 regarding the date of birth

Copy link
Member

@jackcmeyer jackcmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jlato89!

Few changes requested:

  • address comment
  • add test to show that DatePickerWithLabelFormGroup passes maxDate value to DateTimePicker from @hospitalrun/components
  • add test to show that GenrealInformation component sets the max date value to the current day

Please let me now if you need any help! Would love to work through this with you 👍

@@ -22,6 +23,7 @@ const DatePickerWithLabelFormGroup = (props: Props) => {
dateFormat="MM/dd/yyyy"
dateFormatCalendar="LLLL yyyy"
dropdownMode="scroll"
maxDate={addDays(new Date(), 0)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component is intended to be more general than for use inside of the new/edit patient screen.

I think that this interface will only need to expose an optional maxDate and just pass it along to the DateTimePicker from @hopsitalrun/components`.

Then we'll need to make a change in the GenrealInformationComponent to set the maxDate property.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree 100% with your vision. @jlato89 can you handle it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should be able to yes. just an oversight on my part.

@jackcmeyer jackcmeyer added patients issue/pull request that interacts with patients module 🚀enhancement an issue/pull request that adds a feature to the application labels Apr 14, 2020
@jackcmeyer jackcmeyer added this to the v2.0 milestone Apr 14, 2020
@jackcmeyer jackcmeyer requested a review from fox1t April 14, 2020 13:11
Copy link
Member

@fox1t fox1t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @jackcmeyer on proposed changes.

@jlato89
Copy link
Author

jlato89 commented Apr 14, 2020 via email

Added maxDate prop to DatePicker component to avoid DOB being set in the future.

fix HospitalRun#1985
@jlato89
Copy link
Author

jlato89 commented Apr 14, 2020

Added the appropriate changes. Just have to figure out how todo the tests. Then it will be ready to be merged.

@vercel vercel bot requested a deployment to Preview April 16, 2020 15:08 Abandoned
@vercel
Copy link

vercel bot commented Apr 16, 2020

Deployment failed with the following error:

request to https://api.zeit.co/v12/now/deployments?teamId=team_KiGwX2JSRgAI3krc36DK1uGg&skipAutoDetectionConfirmation=1 failed, reason: socket hang up

@jackcmeyer jackcmeyer changed the title feat(datepickerwithlabelformgroup.tsx): max DOB set for current date feat(patients): max DOB set for current date Apr 17, 2020
@jackcmeyer
Copy link
Member

closing in favor of #2002

@jackcmeyer jackcmeyer closed this Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🚀enhancement an issue/pull request that adds a feature to the application patients issue/pull request that interacts with patients module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date of Birth date picker should have max date of the current date
4 participants