Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
fc0ee3bc
Unverified
Commit
fc0ee3bc
authored
Aug 14, 2024
by
Igor Stuev
Committed by
GitHub
Aug 14, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2168 from blockscout/time-ago-noves-fix
fix time ago
parents
9c2e9907
341756f6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
5 deletions
+5
-5
useTimeAgoIncrement.tsx
lib/hooks/useTimeAgoIncrement.tsx
+2
-2
AddressAccountHistoryListItem.tsx
ui/address/accountHistory/AddressAccountHistoryListItem.tsx
+1
-1
AddressAccountHistoryTableItem.tsx
ui/address/accountHistory/AddressAccountHistoryTableItem.tsx
+1
-1
TimeAgoWithTooltip.tsx
ui/shared/TimeAgoWithTooltip.tsx
+1
-1
No files found.
lib/hooks/useTimeAgoIncrement.tsx
View file @
fc0ee3bc
...
...
@@ -19,7 +19,7 @@ function getUnits(diff: number) {
return
[
DAY
,
2
*
DAY
];
}
function
getUpdateParams
(
ts
:
string
)
{
function
getUpdateParams
(
ts
:
string
|
number
)
{
const
timeDiff
=
Date
.
now
()
-
new
Date
(
ts
).
getTime
();
const
[
unit
,
higherUnit
]
=
getUnits
(
timeDiff
);
...
...
@@ -41,7 +41,7 @@ function getUpdateParams(ts: string) {
};
}
export
default
function
useTimeAgoIncrement
(
ts
:
string
|
null
,
isEnabled
?:
boolean
)
{
export
default
function
useTimeAgoIncrement
(
ts
:
string
|
nu
mber
|
nu
ll
,
isEnabled
?:
boolean
)
{
const
[
value
,
setValue
]
=
React
.
useState
(
ts
?
dayjs
(
ts
).
fromNow
()
:
null
);
React
.
useEffect
(()
=>
{
...
...
ui/address/accountHistory/AddressAccountHistoryListItem.tsx
View file @
fc0ee3bc
...
...
@@ -41,7 +41,7 @@ const AddressAccountHistoryListItem = (props: Props) => {
</
Text
>
</
Flex
>
<
TimeAgoWithTooltip
timestamp=
{
(
props
.
tx
.
rawTransactionData
.
timestamp
*
1000
).
toString
()
}
timestamp=
{
props
.
tx
.
rawTransactionData
.
timestamp
*
1000
}
color=
"text_secondary"
borderRadius=
"sm"
fontWeight=
{
500
}
...
...
ui/address/accountHistory/AddressAccountHistoryTableItem.tsx
View file @
fc0ee3bc
...
...
@@ -26,7 +26,7 @@ const AddressAccountHistoryTableItem = (props: Props) => {
<
Tr
>
<
Td
px=
{
3
}
py=
"18px"
fontSize=
"sm"
>
<
TimeAgoWithTooltip
timestamp=
{
(
props
.
tx
.
rawTransactionData
.
timestamp
*
1000
).
toString
()
}
timestamp=
{
props
.
tx
.
rawTransactionData
.
timestamp
*
1000
}
isLoading=
{
props
.
isPlaceholderData
}
color=
"text_secondary"
borderRadius=
"sm"
...
...
ui/shared/TimeAgoWithTooltip.tsx
View file @
fc0ee3bc
...
...
@@ -5,7 +5,7 @@ import dayjs from 'lib/date/dayjs';
import
useTimeAgoIncrement
from
'
lib/hooks/useTimeAgoIncrement
'
;
type
Props
=
{
timestamp
?:
string
|
null
;
timestamp
?:
string
|
nu
mber
|
nu
ll
;
fallbackText
?:
string
;
isLoading
?:
boolean
;
enableIncrement
?:
boolean
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment