Skip to content

Commit

Permalink
[Infrastructure UI] Fix Hosts View date picker for some preset values (
Browse files Browse the repository at this point in the history
…elastic#152339)

## 📓 Summary

Closes elastic#151150

The issue was caused by a missing rounding up when the same string
represented dates.

## 🧪 Testing

- Navigates to Hosts View page.
- Set date-picker to `Today`.
- Verify data are correctly fetched.
Repeat the same setting the picker to `This week`

https://user-images.githubusercontent.com/34506779/221857418-dbc53fe6-6eca-4645-93cd-b939231e76b0.mov

Co-authored-by: Marco Antonio Ghiani <[email protected]>
(cherry picked from commit 671a9d8)
  • Loading branch information
tonyghiani committed Mar 6, 2023
1 parent 5178d15 commit 991ee8a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export const useHostsUrlState = () => {

const getDateRangeAsTimestamp = useCallback(() => {
const from = DateMath.parse(state.dateRange.from)?.valueOf() ?? getDefaultFromTimestamp();
const to = DateMath.parse(state.dateRange.to)?.valueOf() ?? getDefaultToTimestamp();
const to =
DateMath.parse(state.dateRange.to, { roundUp: true })?.valueOf() ?? getDefaultToTimestamp();

return { from, to };
}, [state.dateRange]);
Expand Down

0 comments on commit 991ee8a

Please sign in to comment.