aboutsummaryrefslogtreecommitdiff
path: root/src/util.ts
blob: 81a1e184d462737e2fc611bc8eff579861096ab5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Format date to a string
function formatDate(date: Date): string {
    const options: Intl.DateTimeFormatOptions = {
        year: 'numeric',
        month: 'long',
        day: 'numeric',
        hour: '2-digit',
        minute: '2-digit',
        timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
    };

    return new Date(date).toLocaleDateString(undefined, options);
}

export { formatDate }