feat: add timestamp in csv export filename
This commit is contained in:
parent
e8cd3cae7e
commit
7288ea834e
|
|
@ -11,11 +11,13 @@ export async function loader({ request }: LoaderArgs) {
|
||||||
header: true
|
header: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const timestamp = new Date().toISOString().replace(/\D/g, '').slice(0, -3);
|
||||||
|
|
||||||
return new Response(csv, {
|
return new Response(csv, {
|
||||||
status: 200,
|
status: 200,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'text/csv',
|
'Content-Type': 'text/csv',
|
||||||
'Content-Disposition': 'attachment; filename="export.csv"'
|
'Content-Disposition': `attachment; filename="work-timer-export-${timestamp}.csv"`,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue