add year to date in transaction history (#797)

* add year to date if transaction is from last year or older

* Create cyan-waves-wave.md
This commit is contained in:
Jakub
2025-09-15 14:18:51 +02:00
committed by GitHub
parent e55e99878e
commit 42989409cb
2 changed files with 12 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@status-im/wallet": patch
---
add year to date in transaction history
@@ -1,4 +1,4 @@
import { format, isToday, isYesterday } from 'date-fns'
import { format, isThisYear, isToday, isYesterday } from 'date-fns'
type Props = {
timestamp: Date | string | number
@@ -16,7 +16,12 @@ export const RelativeDate = (props: Props) => {
if (isYesterday(date)) {
return `Yesterday ${format(date, 'HH:mm')}`
}
return format(date, 'dd MMMM HH:mm')
if (isThisYear(date)) {
return format(date, 'dd MMMM HH:mm')
}
return format(date, 'dd MMMM yyyy HH:mm')
}
return <span className={className}>{formatDate()}</span>