-
Notifications
You must be signed in to change notification settings - Fork 232
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
Conversation
Size Change: -182 B (0%) Total Size: 2.36 MB ℹ️ View Unchanged
|
@@ -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(); | |||
|
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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.
startDatetime: new Date( | ||
dayjs(visitDate).year(), | ||
dayjs(visitDate).month(), | ||
dayjs(visitDate).date(), | ||
hours, | ||
minutes, | ||
), |
There was a problem hiding this comment.
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:
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() |
There was a problem hiding this comment.
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.
@mseaton It would be good to have some kind of description for what this PR does besides just a ticket reference. |
Requirements
Related Issue
See https://issues.openmrs.org/browse/O3-2476