frontend/src/helpers/other-functions.tsx   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 17
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2
mnd 0
bc 0
fnc 2
bpm 0
cpm 1
noi 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
}