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) O3-3979: Visit start date field not populating correctly when editing a visit #2019

Merged
merged 2 commits into from
Sep 22, 2024

Conversation

Vijaykv5
Copy link
Contributor

@Vijaykv5 Vijaykv5 commented Sep 18, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This PR fixes the issue where the visit start date field was not populating correctly when editing a visit. The root issue seems to be that while the visit date is correctly captured in the field control, the date value is not being set correctly in the field because the date format is not being set correctly. This PR explicitly sets the date format to DD/MM/YYYY in the DatePicker component. It also amends the existing E2E test to check that the date is correctly captured to prevent future regressions.

Screenshots

Before
Screenshot 2024-09-18 at 7 23 09 PM

After
Screenshot 2024-09-18 at 7 24 26 PM

Related Issue

O3-3979

Other

Copy link
Contributor Author

@Vijaykv5 Vijaykv5 left a comment

Choose a reason for hiding this comment

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

@denniskigen Removing the minDate and maxDate here not a correct fix.

In the Visit-form-component, maxVisitStartDatetime and minVisitStopDatetime is getting null as there is not object present inside visitToEdit.encounters

@denniskigen
Copy link
Member

Thanks for giving this a shot, @Vijaykv5. I don’t think this is the right solution—the root issue seems to be that while the visitStartDate DatePicker has a value, it doesn’t match the expected format, causing the input to appear blank. One way to address this is by explicitly formatting the date, like so:

value={value ? dayjs(value).format('DD/MM/YYYY') : null}

However, I’m unsure if we should be setting date formats explicitly this way.

@denniskigen denniskigen changed the title (fix) O3-3979 : Make the start date displayed in visit form (fix) O3-3979: Visit start date field not populating correctly when editing a visit Sep 18, 2024
@denniskigen
Copy link
Member

Thanks, @Vijaykv5!

@denniskigen denniskigen merged commit b011804 into openmrs:main Sep 22, 2024
6 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.

2 participants