-
Notifications
You must be signed in to change notification settings - Fork 221
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
(feat) O3-4013: Add support for partial (estimated) dates #1280
base: main
Are you sure you want to change the base?
Conversation
Size Change: -92.1 kB (-1.36%) Total Size: 6.67 MB
ℹ️ View Unchanged
|
This leverages the any-date-parser library to parse partial date representations. Note that there are some serious edge cases with estimated birth dates less than a day old, but hopefully that's not something we need to deal with.
Co-authored-by: Donald Kibet <[email protected]>
e8b407b
to
74e0c2a
Compare
So one of the failing e2e tests are expected "e2e/specs/register-new-patient.spec.ts:87:5 › Register an unknown patient › And I should see the newly registered patient's details displayed in the patient banner" where its expecting to see a full birthdate by searching for "01-Jan-2000" which this PR changes to just "2000". So we'll need to update the e2e test itself on patient-management once this goes in. |
The other failing test (is for one very badly written), which tests managing patient lists fails because it tries to test the deletion of a patient from a list (expect it does so by directly calling the API in the test - https://github.com/openmrs/openmrs-esm-patient-management/blob/9201ed389bd8f811ff2c1f265c4ccbf60d5c3079/e2e/specs/patient-list.spec.ts#L84 instead of interacting the UI (as an e2e test should). Anyways the API call apparently fails weirdly which is why the test fails. CC @denniskigen |
Requirements
feat
,fix
, orchore
, among others). See existing PR titles for inspiration.For changes to apps
If applicable
Summary
This should resolve O3-4013. In essence, for estimated birthdates, the FHIR API returns only a partial date. DayJS interpolates this with (essentially) the "zero value" for each field, so, e.g., the FHIR string "2014" (representing "born sometime in 2014") gets interpreted as "2014-01-01", etc. which leads to screens that looks incorrect.
Because I was lazy, this uses the
any-date-parser
even though we don't actually need most of it's features. However, it was the only date parser I could find that would return a partial object instead of trying to construct a date (at least without hacking into non-public APIs). Eventually, we may want to replace this with something lighter-weight.Screenshots
Related Issue
Other
I'm not entirely sure the changes to
age()
are necessary.Note that there are some serious edge cases with estimated birth dates less than a day old, but hopefully that's not something we need to deal with.