mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add datetime to the profiling export filename
This commit is contained in:
@@ -32,8 +32,21 @@ export default function ProfilingImportExportButtons() {
|
||||
|
||||
if (profilingData !== null) {
|
||||
const profilingDataExport = prepareProfilingDataExport(profilingData);
|
||||
const date = new Date();
|
||||
const dateString = date
|
||||
.toLocaleDateString(undefined, {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
})
|
||||
.replace(/\//g, '-');
|
||||
const timeString = date
|
||||
.toLocaleTimeString(undefined, {
|
||||
hour12: false,
|
||||
})
|
||||
.replace(/:/g, '-');
|
||||
downloadFile(
|
||||
'profile-data.json',
|
||||
`profiling-data.${dateString}.${timeString}.json`,
|
||||
JSON.stringify(profilingDataExport, null, 2)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user