Commit 43519199 authored by Igor Stuev's avatar Igor Stuev Committed by GitHub

Add time selector to the CSV export (#2764)

parent d0a80069
...@@ -32,8 +32,8 @@ const CsvExportForm = ({ hash, resource, filterType, filterValue, fileNameTempla ...@@ -32,8 +32,8 @@ const CsvExportForm = ({ hash, resource, filterType, filterValue, fileNameTempla
const formApi = useForm<FormFields>({ const formApi = useForm<FormFields>({
mode: 'onBlur', mode: 'onBlur',
defaultValues: { defaultValues: {
from: dayjs().subtract(1, 'day').format('YYYY-MM-DD'), from: dayjs().subtract(1, 'day').format('YYYY-MM-DDTHH:mm'),
to: dayjs().format('YYYY-MM-DD'), to: dayjs().format('YYYY-MM-DDTHH:mm'),
}, },
}); });
const { handleSubmit, formState } = formApi; const { handleSubmit, formState } = formApi;
...@@ -49,8 +49,8 @@ const CsvExportForm = ({ hash, resource, filterType, filterValue, fileNameTempla ...@@ -49,8 +49,8 @@ const CsvExportForm = ({ hash, resource, filterType, filterValue, fileNameTempla
const url = buildUrl(resource, { hash } as never, { const url = buildUrl(resource, { hash } as never, {
address_id: hash, address_id: hash,
from_period: exportType !== 'holders' ? data.from : null, from_period: exportType !== 'holders' ? dayjs(data.from).toISOString() : null,
to_period: exportType !== 'holders' ? data.to : null, to_period: exportType !== 'holders' ? dayjs(data.to).toISOString() : null,
filter_type: filterType, filter_type: filterType,
filter_value: filterValue, filter_value: filterValue,
recaptcha_response: token, recaptcha_response: token,
......
...@@ -38,7 +38,7 @@ const CsvExportFormField = ({ formApi, name }: Props) => { ...@@ -38,7 +38,7 @@ const CsvExportFormField = ({ formApi, name }: Props) => {
return ( return (
<FormFieldText<FormFields, typeof name> <FormFieldText<FormFields, typeof name>
name={ name } name={ name }
inputProps={{ type: 'date', max: dayjs().format('YYYY-MM-DD') }} inputProps={{ type: 'datetime-local', max: dayjs().format('YYYY-MM-DDTHH:mm') }}
placeholder={ capitalize(name) } placeholder={ capitalize(name) }
required required
rules={{ validate }} rules={{ validate }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment