Skip to content

Conversation

@BlessedAmrita
Copy link

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 is based on designs, which are linked or shown either in the Jira ticket or the description below. (See also: Styleguide)
  • My work includes tests or is validated by existing tests.

Summary

This PR addresses an issue where the Orders app date picker was empty by default, requiring users to manually select a range to view orders. Additionally, the start date logic was updated to use a simple date string (YYYY-MM-DD) to prevent timezone offsets from incorrectly fetching orders from the previous day.

Screenshots

Before:
Screenshot 2026-01-09 231629
Screenshot 2026-01-09 231802
After:
(Default Page)
image
(Any other date)
image

Related Issue

https://issues.openmrs.org/browse/O3-5328

Other

// UI-controlled date range
const [dateRange, setDateRange] = useState<[Date | null, Date | null]>([null, null]);
const [dateRange, setDateRange] = useState<[Date | null, Date | null]>([new Date(), new Date()]);
// Derived API filter dates (ISO strings)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Derived API filter dates (ISO strings)
// Derived API filter dates with explicit time boundaries for accurate date range filtering

[startDate],
);
const selectedFromDate = useMemo(() => (startDate ? dayjs(startDate).format('YYYY-MM-DD') : null), [startDate]);
const selectedToDate = useMemo(() => (endDate ? dayjs(endDate).endOf('day').toISOString() : null), [endDate]);
Copy link
Member

@denniskigen denniskigen Jan 12, 2026

Choose a reason for hiding this comment

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

Suggested change
const selectedToDate = useMemo(() => (endDate ? dayjs(endDate).endOf('day').toISOString() : null), [endDate]);
const selectedFromDate = useMemo(() => {
if (!startDate) {
return null;
}
return dayjs(startDate).startOf('day').toISOString();
}, [startDate]);
const selectedToDate = useMemo(() => {
if (!endDate) {
return null;
}
return dayjs(endDate).endOf('day').millisecond(0).toISOString();
}, [endDate]);

Would something like this work better here, @ibacher? Especially w.r.t to same day filtering and timezone ambiguity.

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