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

O3-2476 - Remove unnecessary conversion from date to string back to date #836

Merged
merged 4 commits into from
Oct 10, 2023

Conversation

mseaton
Copy link
Member

@mseaton mseaton commented Oct 6, 2023

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.

Related Issue

See https://issues.openmrs.org/browse/O3-2476

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2023

Size Change: -182 B (0%)

Total Size: 2.36 MB

ℹ️ View Unchanged
Filename Size Change
packages/esm-active-visits-app/dist/130.js 175 kB 0 B
packages/esm-active-visits-app/dist/316.js 42.9 kB 0 B
packages/esm-active-visits-app/dist/319.js 620 B 0 B
packages/esm-active-visits-app/dist/574.js 543 B 0 B
packages/esm-active-visits-app/dist/588.js 6.66 kB 0 B
packages/esm-active-visits-app/dist/629.js 7.48 kB 0 B
packages/esm-active-visits-app/dist/757.js 637 B 0 B
packages/esm-active-visits-app/dist/784.js 2.63 kB 0 B
packages/esm-active-visits-app/dist/788.js 540 B 0 B
packages/esm-active-visits-app/dist/807.js 856 B 0 B
packages/esm-active-visits-app/dist/833.js 660 B 0 B
packages/esm-active-visits-app/dist/842.js 881 B 0 B
packages/esm-active-visits-app/dist/879.js 2.94 kB 0 B
packages/esm-active-visits-app/dist/909.js 54.2 kB 0 B
packages/esm-active-visits-app/dist/936.js 7.97 kB 0 B
packages/esm-active-visits-app/dist/main.js 3.39 kB 0 B
packages/esm-active-visits-app/dist/openmrs-esm-active-visits-app.js 3.22 kB 0 B
packages/esm-appointments-app/dist/130.js 175 kB 0 B
packages/esm-appointments-app/dist/212.js 103 kB 0 B
packages/esm-appointments-app/dist/223.js 20.9 kB -29 B (0%)
packages/esm-appointments-app/dist/319.js 1.92 kB 0 B
packages/esm-appointments-app/dist/328.js 11.8 kB 0 B
packages/esm-appointments-app/dist/381.js 10.1 kB 0 B
packages/esm-appointments-app/dist/437.js 2.46 kB 0 B
packages/esm-appointments-app/dist/469.js 6.65 kB 0 B
packages/esm-appointments-app/dist/544.js 748 B 0 B
packages/esm-appointments-app/dist/574.js 1.73 kB -1 B (0%)
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/735.js 11.3 kB 0 B
packages/esm-appointments-app/dist/738.js 144 kB 0 B
packages/esm-appointments-app/dist/757.js 1.74 kB -1 B (0%)
packages/esm-appointments-app/dist/784.js 2.63 kB 0 B
packages/esm-appointments-app/dist/788.js 1.74 kB -2 B (0%)
packages/esm-appointments-app/dist/80.js 5.1 kB 0 B
packages/esm-appointments-app/dist/807.js 2.43 kB -1 B (0%)
packages/esm-appointments-app/dist/833.js 2.03 kB -1 B (0%)
packages/esm-appointments-app/dist/884.js 1.96 kB 0 B
packages/esm-appointments-app/dist/main.js 5.5 kB 0 B
packages/esm-appointments-app/dist/openmrs-esm-appointments-app.js 3.18 kB 0 B
packages/esm-patient-list-app/dist/130.js 175 kB 0 B
packages/esm-patient-list-app/dist/255.js 4.4 kB 0 B
packages/esm-patient-list-app/dist/292.js 96 kB 0 B
packages/esm-patient-list-app/dist/294.js 3.32 kB 0 B
packages/esm-patient-list-app/dist/319.js 1.08 kB 0 B
packages/esm-patient-list-app/dist/404.js 2.25 kB 0 B
packages/esm-patient-list-app/dist/477.js 16.3 kB 0 B
packages/esm-patient-list-app/dist/537.js 534 B 0 B
packages/esm-patient-list-app/dist/565.js 2.61 kB 0 B
packages/esm-patient-list-app/dist/574.js 942 B 0 B
packages/esm-patient-list-app/dist/588.js 6.66 kB 0 B
packages/esm-patient-list-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-list-app/dist/716.js 4.62 kB 0 B
packages/esm-patient-list-app/dist/757.js 1.09 kB 0 B
packages/esm-patient-list-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-list-app/dist/788.js 941 B 0 B
packages/esm-patient-list-app/dist/791.js 1.54 kB 0 B
packages/esm-patient-list-app/dist/807.js 1.42 kB 0 B
packages/esm-patient-list-app/dist/833.js 1.13 kB 0 B
packages/esm-patient-list-app/dist/900.js 7.66 kB 0 B
packages/esm-patient-list-app/dist/main.js 3.81 kB 0 B
packages/esm-patient-list-app/dist/openmrs-esm-patient-list-app.js 3.18 kB 0 B
packages/esm-patient-registration-app/dist/117.js 12.1 kB 0 B
packages/esm-patient-registration-app/dist/130.js 175 kB 0 B
packages/esm-patient-registration-app/dist/167.js 27.1 kB 0 B
packages/esm-patient-registration-app/dist/294.js 23.4 kB 0 B
packages/esm-patient-registration-app/dist/319.js 1.59 kB 0 B
packages/esm-patient-registration-app/dist/485.js 29 kB 0 B
packages/esm-patient-registration-app/dist/537.js 3.74 kB 0 B
packages/esm-patient-registration-app/dist/558.js 26 kB 0 B
packages/esm-patient-registration-app/dist/574.js 1.36 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/635.js 456 B 0 B
packages/esm-patient-registration-app/dist/68.js 9.49 kB 0 B
packages/esm-patient-registration-app/dist/735.js 464 B 0 B
packages/esm-patient-registration-app/dist/742.js 721 B 0 B
packages/esm-patient-registration-app/dist/757.js 1.62 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.29 kB 0 B
packages/esm-patient-registration-app/dist/807.js 2.05 kB 0 B
packages/esm-patient-registration-app/dist/833.js 1.59 kB 0 B
packages/esm-patient-registration-app/dist/857.js 2.08 kB 0 B
packages/esm-patient-registration-app/dist/879.js 2.94 kB 0 B
packages/esm-patient-registration-app/dist/975.js 425 B 0 B
packages/esm-patient-registration-app/dist/main.js 21.6 kB 0 B
packages/esm-patient-registration-app/dist/openmrs-esm-patient-registration-app.js 3.23 kB 0 B
packages/esm-patient-search-app/dist/110.js 17 kB 0 B
packages/esm-patient-search-app/dist/128.js 2.01 kB 0 B
packages/esm-patient-search-app/dist/130.js 175 kB 0 B
packages/esm-patient-search-app/dist/262.js 29.4 kB 0 B
packages/esm-patient-search-app/dist/319.js 940 B 0 B
packages/esm-patient-search-app/dist/327.js 1.05 kB 0 B
packages/esm-patient-search-app/dist/357.js 5.72 kB 0 B
packages/esm-patient-search-app/dist/519.js 5.08 kB 0 B
packages/esm-patient-search-app/dist/574.js 792 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/757.js 923 B 0 B
packages/esm-patient-search-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-search-app/dist/788.js 778 B 0 B
packages/esm-patient-search-app/dist/807.js 1.12 kB 0 B
packages/esm-patient-search-app/dist/833.js 947 B 0 B
packages/esm-patient-search-app/dist/842.js 2.06 kB 0 B
packages/esm-patient-search-app/dist/939.js 4.42 kB 0 B
packages/esm-patient-search-app/dist/982.js 1.69 kB 0 B
packages/esm-patient-search-app/dist/main.js 3.45 kB 0 B
packages/esm-patient-search-app/dist/openmrs-esm-patient-search-app.js 3.19 kB 0 B
packages/esm-service-queues-app/dist/130.js 175 kB 0 B
packages/esm-service-queues-app/dist/176.js 5.76 kB 0 B
packages/esm-service-queues-app/dist/242.js 219 B 0 B
packages/esm-service-queues-app/dist/252.js 2.22 kB 0 B
packages/esm-service-queues-app/dist/286.js 2.88 kB 0 B
packages/esm-service-queues-app/dist/308.js 8.15 kB 0 B
packages/esm-service-queues-app/dist/311.js 4.19 kB 0 B
packages/esm-service-queues-app/dist/319.js 3.08 kB 0 B
packages/esm-service-queues-app/dist/328.js 3.08 kB -24 B (-1%)
packages/esm-service-queues-app/dist/330.js 8.6 kB 0 B
packages/esm-service-queues-app/dist/364.js 2.03 kB 0 B
packages/esm-service-queues-app/dist/425.js 3.42 kB -27 B (-1%)
packages/esm-service-queues-app/dist/433.js 25.7 kB -7 B (0%)
packages/esm-service-queues-app/dist/457.js 2.5 kB 0 B
packages/esm-service-queues-app/dist/469.js 6.66 kB 0 B
packages/esm-service-queues-app/dist/53.js 3.11 kB -39 B (-1%)
packages/esm-service-queues-app/dist/574.js 3.1 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/611.js 2.73 kB 0 B
packages/esm-service-queues-app/dist/616.js 3.61 kB 0 B
packages/esm-service-queues-app/dist/627.js 2.94 kB 0 B
packages/esm-service-queues-app/dist/644.js 1.25 kB 0 B
packages/esm-service-queues-app/dist/670.js 155 kB 0 B
packages/esm-service-queues-app/dist/680.js 2.55 kB 0 B
packages/esm-service-queues-app/dist/719.js 5.38 kB 0 B
packages/esm-service-queues-app/dist/733.js 4.07 kB -27 B (-1%)
packages/esm-service-queues-app/dist/757.js 3.08 kB 0 B
packages/esm-service-queues-app/dist/764.js 5.26 kB 0 B
packages/esm-service-queues-app/dist/766.js 4.74 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.08 kB 0 B
packages/esm-service-queues-app/dist/807.js 4.46 kB 0 B
packages/esm-service-queues-app/dist/833.js 3.68 kB 0 B
packages/esm-service-queues-app/dist/86.js 4.4 kB -23 B (-1%)
packages/esm-service-queues-app/dist/981.js 3.63 kB 0 B
packages/esm-service-queues-app/dist/main.js 4 kB 0 B
packages/esm-service-queues-app/dist/openmrs-esm-service-queues-app.js 3.19 kB 0 B

compressed-size-action

@@ -36,7 +38,7 @@ describe('VisitDetailComponent', () => {
render(<VisitDetailComponent visitUuid={visitUuid} patientUuid={patientUuid} />);

expect(screen.getByText(/Some Visit Type/)).toBeInTheDocument();
expect(screen.getByText(/29-Jul-2023, 12:34 PM/)).toBeInTheDocument();
expect(screen.getByText(formatDate(visitDate))).toBeInTheDocument();

Copy link
Member Author

Choose a reason for hiding this comment

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

This test started failing after I made the changes described. But this should not have been passing before if I'm understanding right, because a startDatetime with a "Z" at the end indicates UTC, but my computer running these tests is in EDT, so this shows up as 08:34 AM, not 12:34 PM. I've just changed the test to use a locally generated date, so whatever is passed is the same as what is tested. But it seems that this is potentially a fixed bug.

@@ -63,7 +63,7 @@ const AppointmentDetails: React.FC<AppointmentDetailsProps> = ({ appointment })
<span className={styles.historyGridCount}>{appointmentsCount.cancelledAppointments}</span>
</div>
<div>
<p className={styles.historyGridLabel}>{t('upcomming', 'Upcoming')}</p>
<p className={styles.historyGridLabel}>{t('upcoming', 'Upcoming')}</p>
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure where this came from - this cropped up as message changes when I tried to commit, I noticed this typo, so I fixed it (which enabled us to not lose the existing translations).

@@ -36,7 +36,7 @@ export async function saveQueueEntry(
patient: {
uuid: patientUuid,
},
startedAt: toDateObjectStrict(toOmrsIsoString(new Date())),
startedAt: new Date(),
Copy link
Member Author

Choose a reason for hiding this comment

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

Most of the changes in this PR are this. Find/replace wherever we are converting from date->string->date and just using the original date instead.

Comment on lines +101 to 107
startDatetime: new Date(
dayjs(visitDate).year(),
dayjs(visitDate).month(),
dayjs(visitDate).date(),
hours,
minutes,
),
Copy link
Member

Choose a reason for hiding this comment

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

It might be easier to write this as:

Suggested change
startDatetime: new Date(
dayjs(visitDate).year(),
dayjs(visitDate).month(),
dayjs(visitDate).date(),
hours,
minutes,
),
startDatetime: dayjs(visitDate).set('hour', hours).set('minute', minutes).startOf('minute').toDate()

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed that this might be better, but since I haven't tested that, and the current retains the existing approach, I'll leave it for now.

@ibacher
Copy link
Member

ibacher commented Oct 10, 2023

@mseaton It would be good to have some kind of description for what this PR does besides just a ticket reference.

@mseaton mseaton changed the title O3 2476 O3-2476 - Remove unnecessary conversion from date to string back to date Oct 10, 2023
@mseaton mseaton merged commit 863ca3c into main Oct 10, 2023
6 checks passed
@mseaton mseaton deleted the O3-2476 branch October 10, 2023 13:02
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