| 1 |
export const formatDate = (date: string): string => { |
| 2 |
const formattedDate = new Date(date + 'Z'); // Append 'Z' to indicate UTC timezone |
| 3 |
|
| 4 |
const options: Intl.DateTimeFormatOptions = { |
| 5 |
year: 'numeric', |
| 6 |
month: 'numeric', |
| 7 |
day: 'numeric', |
| 8 |
hour: 'numeric', |
| 9 |
minute: 'numeric', |
| 10 |
}; |
| 11 |
|
| 12 |
const displayDate = formattedDate.toLocaleString('en-US', options).replace(',', ' AT'); |
| 13 |
return displayDate; |
| 14 |
}; |
| 15 |
|
| 16 |
export const formatNumber = (value: number): string => { |
| 17 |
return Intl.NumberFormat('en-US').format(value); |
| 18 |
}; |
| 19 |
|
| 20 |
export const formatPercentage = (value: number): string => { |
| 21 |
const roundedPercentage = Math.round(value * 100); |
| 22 |
return `${roundedPercentage}%`; |
| 23 |
}; |
| 24 |
|