Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 17 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | export function formatTimestamp(isoString: string): string | null { |
||
2 | const date = new Date(isoString); |
||
3 | const dateOptions: Intl.DateTimeFormatOptions = { |
||
4 | year: 'numeric', |
||
5 | month: '2-digit', |
||
6 | day: '2-digit', |
||
7 | hour: '2-digit', |
||
8 | minute: '2-digit', |
||
9 | second: '2-digit', |
||
10 | hour12: false, // 24-hour format |
||
11 | timeZone: 'Europe/Stockholm' // Set Sweden's time zone |
||
12 | }; |
||
13 | const formatter = new Intl.DateTimeFormat('sv-SE', dateOptions); // 'sv-SE' is the Swedish locale |
||
14 | const formattedDate = formatter.format(date); |
||
15 | |||
16 | return formattedDate; |
||
17 | } |