From fea7bc21366f6944292d07f2ee48eb42b70451d7 Mon Sep 17 00:00:00 2001 From: anhnhu Date: Fri, 14 Jun 2024 14:17:50 +0700 Subject: [PATCH] Change limit in leaderboard --- .../src/Popup/Home/Leaderboard/index.tsx | 2 +- packages/extension-koni-ui/src/utils/date/index.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/extension-koni-ui/src/Popup/Home/Leaderboard/index.tsx b/packages/extension-koni-ui/src/Popup/Home/Leaderboard/index.tsx index 73f8930892..a0c87f9497 100644 --- a/packages/extension-koni-ui/src/Popup/Home/Leaderboard/index.tsx +++ b/packages/extension-koni-ui/src/Popup/Home/Leaderboard/index.tsx @@ -95,7 +95,7 @@ const Component = ({ className }: Props): React.ReactElement => { let karuraBoardSub: { unsubscribe: () => void } | null = null; if (selectedTab === TabType.KARURA_PLAYDROP) { - karuraBoardSub = apiSDK.subscribeLeaderboard(start, end, 0, 1500).subscribe((data) => { + karuraBoardSub = apiSDK.subscribeLeaderboard(start, end, 0, 100).subscribe((data) => { setLeaderBoard(data); }); } else { diff --git a/packages/extension-koni-ui/src/utils/date/index.ts b/packages/extension-koni-ui/src/utils/date/index.ts index 9773632cc4..09e7b5f01b 100644 --- a/packages/extension-koni-ui/src/utils/date/index.ts +++ b/packages/extension-koni-ui/src/utils/date/index.ts @@ -19,6 +19,17 @@ export const formatDateFully = (date: Date) => { return `${year}-${month}-${day} ${hour}:${minute}:${second}`; }; +const formatFully = (date: Date) => { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); // Tháng bắt đầu từ 0 + const day = String(date.getDate()).padStart(2, '0'); + const hour = String(date.getHours()).padStart(2, '0'); + const minute = String(date.getMinutes()).padStart(2, '0'); + const second = String(date.getSeconds()).padStart(2, '0'); + + return `${year}-${month}-${day} ${hour}:${minute}:${second}`; +}; + export function calculateStartAndEnd (key: string) { const today = new Date(); const year = today.getUTCFullYear(); @@ -40,7 +51,7 @@ export function calculateStartAndEnd (key: string) { const startDate = new Date(startEnv); const endDate = new Date(endEnv); - return { start: formatDateFully(startDate), end: formatDateFully(endDate) }; + return { start: formatFully(startDate), end: formatFully(endDate) }; } default: