Skip to content

fix(DateDetails): truncate the Unix timestamp instead of rounding it - #1340

Merged
hoorayimhelping merged 1 commit into
ClickHouse:mainfrom
nikhil-kthota:fix/date-details-unix-seconds
Dec 3, 2026
Merged

hoorayimhelping merged 1 commit into
ClickHouse:mainfrom
nikhil-kthota:fix/date-details-unix-seconds

Conversation

@nikhil-kthota

@nikhil-kthota nikhil-kthota commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • The Unix row in DateDetails used Math.round(ms / 1000), so any date with 500 ms or more showed the next second (e.g. 11:40:00.750 displayed 1735058401 instead of 1735058400). Unix time truncates, so this now uses dayjs().unix(), which floors.
  • Added a test with a sub-second date. The existing tests all use whole-second dates, which is why this wasn't caught.

Links and tickets

None.

Good to know

Only affects dates with a millisecond part of 500 or more; whole-second dates render the same as before.

Checklist

  • Breaking changes? (add migration notes in changesets)
  • Visual changes? (specify in changesets)
  • Design review needed?

Contribution

  • Sufficient research before PR
  • Self-reviewed the PR
  • Manually tested the changes (when applies - visual confirmation in Storybook)
  • build and build-storybook work locally
  • Tests and Stories are aligned with the changes

Accessibility

No markup, behavior or style changes.


Note

Low Risk
Small display fix in a UI component with a targeted unit test; no auth, data, or API impact.

Overview
Fixes incorrect Unix values in the DateDetails popover by switching from Math.round(ms / 1000) to dayjsDate.unix(), so sub-second times floor to whole seconds instead of rounding up at 500 ms (e.g. 11:40:00.750 now shows 1735058400).

Adds a regression test for a date with 750 ms and documents the patch in the changeset. Whole-second inputs behave the same as before.

Reviewed by Cursor Bugbot for commit 9b4bfa4. Bugbot is set up for automated code reviews on this repo. Configure here.

The Unix row used Math.round(ms / 1000), so any date with 500 ms or more showed the next second. Unix time truncates; use dayjs().unix(), which floors.
@changeset-bot

changeset-bot Bot commented Nov 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9b4bfa4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clickhouse/click-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@workflow-authentication-public

Copy link
Copy Markdown
Contributor

Chromatic Storybook

Check Status Link
Storybook ✅ 672 stories published Open Storybook
UI Tests ✅ 672 tests unchanged Open build

Built from commit: 9b4bfa47268fb7935e329a7df76fe5f3ce248bd7 · Chromatic run

Statuses as of the end of the run. The build link shows the live review state.

@XOP
XOP requested review from hoorayimhelping and mdevils and a balanced review from Copilot December 1, 2026 13:50
@XOP XOP added the enhancement New feature or request label Dec 1, 2026

Copilot AI 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.

🟢 Approval recommended

The Unix timestamp display change has no active review issues.

No open issues 🎉

What changed in this PR

Fixes the Unix timestamp displayed by DateDetails so fractional seconds are floored rather than rounded to the nearest second.

Changes:

  • Uses dayjsDate.unix() to calculate whole Unix seconds.
  • Adds a regression test for an input with 750 milliseconds.
  • Documents the fix in a patch changeset.
File Description
src/​components/​DateDetails/​DateDetails.tsx Replaces timestamp rounding with Day.js Unix conversion.
src/​components/​DateDetails/​DateDetails.test.tsx Verifies that a sub-second timestamp does not round up.
.changeset/​fix-date-details-unix-seconds.md Adds a patch release note for the corrected display.

Review effort: Balanced

@hoorayimhelping
hoorayimhelping merged commit 34b8cab into ClickHouse:main Dec 3, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants