Adds card for showing response times

This commit is contained in:
Alicia Sykes
2023-06-29 23:40:51 +01:00
parent 2907e7b570
commit 0bc0c54e40
9 changed files with 59 additions and 9 deletions

View File

@@ -64,14 +64,16 @@ const formatDate = (dateString: string): string => {
day: 'numeric', month: 'long', year: 'numeric'
}).format(new Date(dateString));
}
const formatValue = (value: any): string => {
const isValidDate = (date: any) => date instanceof Date && !isNaN(date as any as number);
const isValidDate = (date: any) => {
return date instanceof Date && !isNaN(date as any as number) && date >= new Date('1980-01-01');
};
if (isValidDate(new Date(value))) return formatDate(value);
if (typeof value === 'boolean') return value ? '✅' : '❌';
return value;
};
const copyToClipboard = (text: string) => {
navigator.clipboard.writeText(text);
}