1
1
import { type ReactNode } from "react"
2
+ import { useRouter } from "next/router"
2
3
import { useTranslation } from "next-i18next"
3
4
import { MdInfoOutline } from "react-icons/md"
4
5
5
6
import { cn } from "@/lib/utils/cn"
7
+ import { isValidDate } from "@/lib/utils/date"
6
8
7
9
import Tooltip from "../Tooltip"
8
10
import Link from "../ui/Link"
@@ -25,13 +27,13 @@ const BigNumber = ({
25
27
className,
26
28
} : BigNumberProps ) => {
27
29
const { t } = useTranslation ( "common" )
28
- // const { locale } = useRouter()
29
- // const lastUpdatedDisplay =
30
- // lastUpdated && isValidDate(lastUpdated)
31
- // ? new Intl.DateTimeFormat(locale, {
32
- // dateStyle: "medium",
33
- // }).format(new Date(lastUpdated))
34
- // : ""
30
+ const { locale } = useRouter ( )
31
+ const lastUpdatedDisplay =
32
+ lastUpdated && isValidDate ( lastUpdated )
33
+ ? new Intl . DateTimeFormat ( locale , {
34
+ dateStyle : "medium" ,
35
+ } ) . format ( new Date ( lastUpdated ) )
36
+ : ""
35
37
return (
36
38
< div
37
39
className = { cn (
@@ -54,8 +56,7 @@ const BigNumber = ({
54
56
</ p >
55
57
{ lastUpdated && (
56
58
< p className = "mt-2" >
57
- { t ( "last-updated" ) } :{ " " }
58
- { new Date ( lastUpdated ) . toISOString ( ) }
59
+ { t ( "last-updated" ) } : { lastUpdatedDisplay }
59
60
</ p >
60
61
) }
61
62
</ >
0 commit comments