Skip to content

O3-5760: Accept timezone-qualified dates in queue entry searches - #121

Merged
NethmiRodrigo merged 2 commits into
openmrs:mainfrom
UjjawalPrabhat:O3-5760-rest-date-timezone
Aug 27, 2026
Merged

NethmiRodrigo merged 2 commits into
openmrs:mainfrom
UjjawalPrabhat:O3-5760-rest-date-timezone

Conversation

@UjjawalPrabhat

@UjjawalPrabhat UjjawalPrabhat commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

From #2615: scoping the average-wait-time card to "today" meant sending startedOnOrAfter, but there was no way to say which midnight — the parser used a bare SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), which carries no offset and throws on anything else. Clients were left guessing the server's timezone, and a browser ahead of the server silently hid the whole morning.

Now parsed with ConversionUtil.convert(String, Date.class), the same call EncounterSearchHandler2_0 and VisitResource1_9 use upstream, so a client can send an instant and let the server resolve it.

Worth Noting:

  • Backward compatible: ConversionUtil still accepts the old zone-less form, so existing clients are unaffected (there's a test pinning it).
  • Unparseable dates now return 400, not 500 — ConversionException is annotated @ResponseStatus(BAD_REQUEST).

Related Issue

O3-5760

Other

Frontend counterpart: #2615.

@NethmiRodrigo NethmiRodrigo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @UjjawalPrabhat! A couple of suggestions -

- A blank date param (e.g. ?startedOnOrAfter=) now raises a 400 rather than
  silently dropping the filter and returning everything.
- parseDate takes the parameter name and rethrows ConversionException with it,
  so a request carrying several date params says which one failed.
- Cover startedOn and endedOn, which moved to the new parser too, plus the
  blank case next to the unparseable one.
@sonarqubecloud

Copy link
Copy Markdown

@NethmiRodrigo NethmiRodrigo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @UjjawalPrabhat!

@NethmiRodrigo
NethmiRodrigo merged commit 13ee65a into openmrs:main Aug 27, 2026
9 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