Skip to content

Conversation

@lukaw3d
Copy link
Member

@lukaw3d lukaw3d commented Dec 18, 2025

Fixes #2377

http://localhost:1234/mainnet/consensus/block/17407756 showed "1 yr" and "2 years ago" in tooltip. This could be fixed with formatDistanceStrict rounding: floor, but then http://localhost:1234/mainnet/consensus/block/26177788 "4 mo" and "3 months ago" in tooltip. So instead, reused formatDistanceToNow.

@github-actions
Copy link

github-actions bot commented Dec 18, 2025

Deployed to Cloudflare Pages

Latest commit: c1fd2120603bae1a014501620593e12321230b13
Status:✅ Deploy successful!
Preview URL: https://ceaca9a4.oasis-explorer.pages.dev
Alias: https://pr-2401.oasis-explorer.pages.dev

export const formatDistanceToNow = (
date: Date | number,
options: { baseDate?: Date | number; locale?: string; keepSuffix?: true } = {},
options: { baseDate?: Date | number; locale?: string; keepSuffix?: true, style?: 'short' | 'long' } = {},
Copy link
Contributor

Choose a reason for hiding this comment

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

lint

http://localhost:1234/mainnet/consensus/block/17407756 showed "1 yr" and
"2 years ago" in tooltip. This could be fixed with formatDistanceStrict
rounding: floor, but then http://localhost:1234/mainnet/consensus/block/26177788
"4 mo" and "3 months ago" in tooltip. So instead, reused formatDistanceToNow.
@lukaw3d lukaw3d force-pushed the lw/consistent-relative-time branch from 5b61e56 to c1fd212 Compare December 19, 2025 17:55
@lukaw3d lukaw3d enabled auto-merge December 19, 2025 17:56
@lukaw3d lukaw3d merged commit 71a5a87 into master Dec 19, 2025
10 checks passed
@lukaw3d lukaw3d deleted the lw/consistent-relative-time branch December 19, 2025 17:57
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 years ago" is equal to "1 yr"?

3 participants