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-2693 Appointment Creation Form DatePicker uses incorrect minDate format #919

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

chibongho
Copy link
Contributor

@chibongho chibongho commented Jan 4, 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

As of today (2024-01-03) the Appointment creation DatePicker only allows for dates after 2024-04-20
image

With this change, the minDate defaults correctly to today's date (2024-01-03)
image

The Carbon documentation is lacking on what format should be accepted for its minDate and maxDate params. From cursory trial-and-error, it seems like the format should follow the dateFormat passed in to the DatePicker.

https://react.carbondesignsystem.com/?path=/docs/components-datepicker--overview#datepicker-mindate

Screenshots

Related Issue

This is a quick fix for this particular issue, but there are likely other similar problems elsewhere in the code base. A more complete fix should probably involve a standardized DatePicker. See:
https://openmrs.atlassian.net/browse/O3-998
https://openmrs.atlassian.net/browse/O3-1991

Other

Copy link
Contributor

github-actions bot commented Jan 4, 2024

Size Change: +11 B (0%)

Total Size: 2.84 MB

ℹ️ View Unchanged
Filename Size Change
packages/esm-active-visits-app/dist/130.js 109 kB 0 B
packages/esm-active-visits-app/dist/255.js 2.21 kB 0 B
packages/esm-active-visits-app/dist/277.js 12.2 kB 0 B
packages/esm-active-visits-app/dist/316.js 42.9 kB 0 B
packages/esm-active-visits-app/dist/319.js 631 B 0 B
packages/esm-active-visits-app/dist/382.js 1.15 kB 0 B
packages/esm-active-visits-app/dist/460.js 727 B 0 B
packages/esm-active-visits-app/dist/574.js 553 B 0 B
packages/esm-active-visits-app/dist/588.js 6.66 kB 0 B
packages/esm-active-visits-app/dist/635.js 1.15 kB 0 B
packages/esm-active-visits-app/dist/729.js 3.1 kB 0 B
packages/esm-active-visits-app/dist/757.js 649 B 0 B
packages/esm-active-visits-app/dist/784.js 2.63 kB 0 B
packages/esm-active-visits-app/dist/788.js 551 B 0 B
packages/esm-active-visits-app/dist/807.js 864 B 0 B
packages/esm-active-visits-app/dist/833.js 669 B 0 B
packages/esm-active-visits-app/dist/879.js 2.94 kB 0 B
packages/esm-active-visits-app/dist/964.js 50.8 kB 0 B
packages/esm-active-visits-app/dist/main.js 67.5 kB 0 B
packages/esm-active-visits-app/dist/openmrs-esm-active-visits-app.js 3.33 kB 0 B
packages/esm-appointments-app/dist/130.js 109 kB 0 B
packages/esm-appointments-app/dist/152.js 257 B 0 B
packages/esm-appointments-app/dist/255.js 2.23 kB 0 B
packages/esm-appointments-app/dist/303.js 258 B 0 B
packages/esm-appointments-app/dist/319.js 1.99 kB 0 B
packages/esm-appointments-app/dist/460.js 2.18 kB 0 B
packages/esm-appointments-app/dist/469.js 6.65 kB 0 B
packages/esm-appointments-app/dist/530.js 246 kB 0 B
packages/esm-appointments-app/dist/574.js 1.74 kB 0 B
packages/esm-appointments-app/dist/591.js 16.9 kB 0 B
packages/esm-appointments-app/dist/610.js 6.71 kB 0 B
packages/esm-appointments-app/dist/729.js 3.1 kB 0 B
packages/esm-appointments-app/dist/757.js 1.75 kB 0 B
packages/esm-appointments-app/dist/784.js 2.63 kB 0 B
packages/esm-appointments-app/dist/788.js 1.75 kB 0 B
packages/esm-appointments-app/dist/799.js 48.2 kB +6 B (0%)
packages/esm-appointments-app/dist/80.js 2.53 kB 0 B
packages/esm-appointments-app/dist/807.js 2.4 kB 0 B
packages/esm-appointments-app/dist/833.js 1.99 kB 0 B
packages/esm-appointments-app/dist/main.js 298 kB +5 B (0%)
packages/esm-appointments-app/dist/openmrs-esm-appointments-app.js 3.29 kB 0 B
packages/esm-patient-list-management-app/dist/130.js 109 kB 0 B
packages/esm-patient-list-management-app/dist/255.js 2.21 kB 0 B
packages/esm-patient-list-management-app/dist/319.js 1.52 kB 0 B
packages/esm-patient-list-management-app/dist/382.js 1.15 kB 0 B
packages/esm-patient-list-management-app/dist/460.js 1.72 kB 0 B
packages/esm-patient-list-management-app/dist/493.js 21.9 kB 0 B
packages/esm-patient-list-management-app/dist/497.js 104 kB 0 B
packages/esm-patient-list-management-app/dist/574.js 1.33 kB 0 B
packages/esm-patient-list-management-app/dist/588.js 6.66 kB 0 B
packages/esm-patient-list-management-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-list-management-app/dist/635.js 1.15 kB 0 B
packages/esm-patient-list-management-app/dist/716.js 4.65 kB 0 B
packages/esm-patient-list-management-app/dist/729.js 3.1 kB 0 B
packages/esm-patient-list-management-app/dist/757.js 1.5 kB 0 B
packages/esm-patient-list-management-app/dist/784.js 2.64 kB 0 B
packages/esm-patient-list-management-app/dist/788.js 1.33 kB 0 B
packages/esm-patient-list-management-app/dist/807.js 1.84 kB 0 B
packages/esm-patient-list-management-app/dist/833.js 1.58 kB 0 B
packages/esm-patient-list-management-app/dist/main.js 130 kB 0 B
packages/esm-patient-list-management-app/dist/openmrs-esm-patient-list-management-app.js 3.3 kB 0 B
packages/esm-patient-registration-app/dist/130.js 109 kB 0 B
packages/esm-patient-registration-app/dist/152.js 262 B 0 B
packages/esm-patient-registration-app/dist/209.js 35.9 kB 0 B
packages/esm-patient-registration-app/dist/255.js 2.21 kB 0 B
packages/esm-patient-registration-app/dist/303.js 260 B 0 B
packages/esm-patient-registration-app/dist/319.js 1.74 kB 0 B
packages/esm-patient-registration-app/dist/460.js 1.79 kB 0 B
packages/esm-patient-registration-app/dist/492.js 118 kB 0 B
packages/esm-patient-registration-app/dist/537.js 2.35 kB 0 B
packages/esm-patient-registration-app/dist/574.js 1.49 kB 0 B
packages/esm-patient-registration-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-registration-app/dist/62.js 6.86 kB 0 B
packages/esm-patient-registration-app/dist/729.js 3.1 kB 0 B
packages/esm-patient-registration-app/dist/735.js 464 B 0 B
packages/esm-patient-registration-app/dist/757.js 1.74 kB 0 B
packages/esm-patient-registration-app/dist/784.js 2.64 kB 0 B
packages/esm-patient-registration-app/dist/788.js 1.42 kB 0 B
packages/esm-patient-registration-app/dist/807.js 2.2 kB 0 B
packages/esm-patient-registration-app/dist/833.js 1.75 kB 0 B
packages/esm-patient-registration-app/dist/879.js 2.94 kB 0 B
packages/esm-patient-registration-app/dist/884.js 6.1 kB 0 B
packages/esm-patient-registration-app/dist/main.js 156 kB 0 B
packages/esm-patient-registration-app/dist/openmrs-esm-patient-registration-app.js 3.34 kB 0 B
packages/esm-patient-search-app/dist/130.js 109 kB 0 B
packages/esm-patient-search-app/dist/152.js 261 B 0 B
packages/esm-patient-search-app/dist/255.js 2.21 kB 0 B
packages/esm-patient-search-app/dist/303.js 260 B 0 B
packages/esm-patient-search-app/dist/319.js 936 B 0 B
packages/esm-patient-search-app/dist/382.js 1.15 kB 0 B
packages/esm-patient-search-app/dist/423.js 25.2 kB 0 B
packages/esm-patient-search-app/dist/460.js 1.06 kB 0 B
packages/esm-patient-search-app/dist/574.js 781 B 0 B
packages/esm-patient-search-app/dist/588.js 6.66 kB 0 B
packages/esm-patient-search-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-search-app/dist/635.js 1.15 kB 0 B
packages/esm-patient-search-app/dist/729.js 3.1 kB 0 B
packages/esm-patient-search-app/dist/757.js 938 B 0 B
packages/esm-patient-search-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-search-app/dist/788.js 776 B 0 B
packages/esm-patient-search-app/dist/807.js 1.11 kB 0 B
packages/esm-patient-search-app/dist/832.js 26 kB 0 B
packages/esm-patient-search-app/dist/833.js 964 B 0 B
packages/esm-patient-search-app/dist/main.js 54.5 kB 0 B
packages/esm-patient-search-app/dist/openmrs-esm-patient-search-app.js 3.34 kB 0 B
packages/esm-service-queues-app/dist/130.js 109 kB 0 B
packages/esm-service-queues-app/dist/152.js 262 B 0 B
packages/esm-service-queues-app/dist/200.js 161 kB 0 B
packages/esm-service-queues-app/dist/255.js 2.23 kB 0 B
packages/esm-service-queues-app/dist/303.js 261 B 0 B
packages/esm-service-queues-app/dist/319.js 3.14 kB 0 B
packages/esm-service-queues-app/dist/328.js 3.09 kB 0 B
packages/esm-service-queues-app/dist/389.js 2.42 kB 0 B
packages/esm-service-queues-app/dist/425.js 2.06 kB 0 B
packages/esm-service-queues-app/dist/460.js 3.98 kB 0 B
packages/esm-service-queues-app/dist/469.js 6.66 kB 0 B
packages/esm-service-queues-app/dist/574.js 3.14 kB 0 B
packages/esm-service-queues-app/dist/591.js 16.9 kB 0 B
packages/esm-service-queues-app/dist/610.js 6.71 kB 0 B
packages/esm-service-queues-app/dist/616.js 2.71 kB 0 B
packages/esm-service-queues-app/dist/694.js 2.64 kB 0 B
packages/esm-service-queues-app/dist/729.js 3.1 kB 0 B
packages/esm-service-queues-app/dist/757.js 3.14 kB 0 B
packages/esm-service-queues-app/dist/784.js 2.63 kB 0 B
packages/esm-service-queues-app/dist/788.js 3.13 kB 0 B
packages/esm-service-queues-app/dist/807.js 4.37 kB 0 B
packages/esm-service-queues-app/dist/833.js 3.63 kB 0 B
packages/esm-service-queues-app/dist/89.js 52.5 kB 0 B
packages/esm-service-queues-app/dist/981.js 2.93 kB 0 B
packages/esm-service-queues-app/dist/main.js 216 kB 0 B
packages/esm-service-queues-app/dist/openmrs-esm-service-queues-app.js 3.31 kB 0 B

compressed-size-action

@chibongho chibongho requested a review from ibacher January 4, 2024 04:25
@denniskigen
Copy link
Member

denniskigen commented Jan 4, 2024

Based on the available guidance for the maxDate prop, it looks like the maxDate and minDate values default to using the US date format, and that the value depends on whatever the locale prop is set to.

Copy link
Member

@denniskigen denniskigen left a comment

Choose a reason for hiding this comment

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

LGTM

@chibongho chibongho merged commit 17b2bb0 into main Jan 4, 2024
6 checks passed
@chibongho chibongho deleted the fix/O3-2693 branch January 4, 2024 13:31
@@ -90,7 +90,7 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
);

const appointmentService = services?.find(({ uuid }) => uuid === patientAppointment.serviceUuid);
const today = dayjs().startOf('day').format();
const today = dayjs().startOf('day').format('DD/MM/YYYY');
Copy link
Member

Choose a reason for hiding this comment

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

Adding a quick comment without knowing much about this ticket or the broader tickets, which I think are meant to deal with this broadly. but the display format of a date should be customizable by implementation. For our default in O2, we tend to use a format "1-Jan-2024" , which the month specifically implemented as text so that "DD/MM/YYYY" is not misintrepreted as "MM/DD/YYYY" format by US users. But you may already be on top of that... :) Again, I realize this is a quick fix just to get this working again.

Copy link
Member

Choose a reason for hiding this comment

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

We can directly pass the date object in the maxDate prop, instead of the format, which is more reliable.
CC: @ibacher @denniskigen

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Oh... yes, if the use of this variable is to populate the maxDate prop, we shouldn't be doing any formatting with it at all, as that will be pretty inherently non-portable.

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.

5 participants