diff --git a/src/pages/ExportData/index.tsx b/src/pages/ExportData/index.tsx index df2dada..c42cf57 100644 --- a/src/pages/ExportData/index.tsx +++ b/src/pages/ExportData/index.tsx @@ -111,9 +111,9 @@ export const ExportData = () => { offset: 0, limit: 1, orderBy: 'number', - orderDirection: 'asc', + orderDirection: 'desc', filters: [{ - type: 'gte', + type: 'lte', property: 'timestamp', value: `'${dateFrom}'` }] @@ -128,16 +128,21 @@ export const ExportData = () => { } } if (dateTo) { + const diff = dayjs().diff(dayjs(dateTo), 'days') + const isCurrentDateOrNext = diff <= 0 const blockToFilter = { offset: 0, limit: 1, orderBy: 'number', orderDirection: 'desc', - filters: [{ - type: 'lt', + filters: [] as any + } + if(!isCurrentDateOrNext) { + blockToFilter.filters.push({ + type: 'lte', property: 'timestamp', value: `'${dayjs(dateTo).add(1, 'day').format(dateFormat)}'` - }] + }) } const [blockTo] = await getBlocks([0, blockToFilter]); if(blockTo) { @@ -202,27 +207,29 @@ export const ExportData = () => { Export the last {DefaultLimit} {getTxTextType(type)} for
{type === 'transaction' && 'starting from'} -