Skip to content

[EuiSuperDatePicker] Prevent time window steps from drifting by 1ms#9434

Merged
mgadewoll merged 3 commits intoelastic:mainfrom
mgadewoll:superdatepicker/fix-1ms-time-window-drift
Mar 13, 2026
Merged

[EuiSuperDatePicker] Prevent time window steps from drifting by 1ms#9434
mgadewoll merged 3 commits intoelastic:mainfrom
mgadewoll:superdatepicker/fix-1ms-time-window-drift

Conversation

@mgadewoll
Copy link
Copy Markdown
Contributor

@mgadewoll mgadewoll commented Mar 9, 2026

Summary

This PR updates EuiSuperDatePicker to fix unexpected time shifts by 1ms when using the time window buttons.

The issue was that the roundUp on dateMath.parse({date}, { roundUp: true }) results in .999ms times for relative dates like "Today". This results in a 1ms difference that's being carried across time window steps.

This update ensures that the time window range is adjusted accordingly for "inclusive" dates (ending on the last ms of the date instead of the first ms of the next date) to keep a stable ms range.

Note

A similar issue was previously resolved for absolute dates in #8985.

Why are we making this change?

🧰 Bug fix: This bug was reported to us by @KodeRad. This update ensures that the time window steps result in stable start and end date/time.

Screenshots #

scenario before after
step backwards
Screen.Recording.2026-03-09.at.15.11.09.mov
Screen.Recording.2026-03-09.at.15.12.53.mov
step forwards
Screen.Recording.2026-03-09.at.15.10.36.mov
Screen.Recording.2026-03-09.at.15.13.34.mov
zoom out
Screen.Recording.2026-03-09.at.15.11.37.mov
Screen.Recording.2026-03-09.at.15.14.04.mov
absolute dates
Screen.Recording.2026-03-09.at.15.24.35.mov
Screen.Recording.2026-03-09.at.15.25.26.mov

Impact to users

🟢 No updates required on consumer side.

QA

  • select "Today" via the quick select menu and:
    • the date range is 00:00:00.000 - 23:59:59.999
    • verify that stepping forward on EuiSuperDatePicker time windows results in the same range of 00:00:00.000 - 23:59:59.999 for the previous day(s)
    • verify that stepping backwards on EuiSuperDatePicker time windows results in the same range of 00:00:00.000 - 23:59:59.999 for the previous day(s)
    • verify that zooming out results in start .000ms and end .999ms ranges
  • Select absolute start and end dates and verify there is no regression with production when using forward/backward steps or zoom out

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in both MacOS and Windows high contrast modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
    • If the changes unblock an issue in a different repo, smoke tested carefully (see Testing EUI features in Kibana ahead of time)
  • Designer checklist
    • If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

@mgadewoll mgadewoll self-assigned this Mar 9, 2026
@mgadewoll mgadewoll added the support-duty-flywheel Label for PRs, see eui-private #310 label Mar 9, 2026
@mgadewoll mgadewoll marked this pull request as ready for review March 9, 2026 16:11
@mgadewoll mgadewoll requested a review from a team as a code owner March 9, 2026 16:11
@weronikaolejniczak weronikaolejniczak self-requested a review March 10, 2026 11:39
Copy link
Copy Markdown
Contributor

@weronikaolejniczak weronikaolejniczak left a comment

Choose a reason for hiding this comment

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

Thank you for fixing the issue, Lene! I tested the solution, I see no 1ms drift or any regression 🟢 I have a couple of nits only.

Testing notes

Stepping backwards & forwards

Image

Absolute dates

Image

Zoom in & out

Image

Image

Comment thread packages/eui/src/components/date_picker/super_date_picker/time_window_buttons.tsx Outdated
Comment thread packages/eui/src/components/date_picker/super_date_picker/time_window_buttons.tsx Outdated
@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

cc @mgadewoll

@mgadewoll mgadewoll merged commit 39581da into elastic:main Mar 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

support-duty-flywheel Label for PRs, see eui-private #310

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants