diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2024-02-05 09:52:51 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2024-02-05 09:52:51 -0500 |
| commit | dfdf64af769b97d2342cf8b3c6fa25106bfb9acf (patch) | |
| tree | b8968ce81eee55cc0898c1ed9d1194403b9c3c56 /src/util.ts | |
| parent | 97cc04f9d8cba1c06a1587428e4b76d5d58e1801 (diff) | |
| download | personal-website-dfdf64af769b97d2342cf8b3c6fa25106bfb9acf.tar.gz personal-website-dfdf64af769b97d2342cf8b3c6fa25106bfb9acf.tar.bz2 personal-website-dfdf64af769b97d2342cf8b3c6fa25106bfb9acf.zip | |
Formatted date
Diffstat (limited to 'src/util.ts')
| -rw-r--r-- | src/util.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/util.ts b/src/util.ts index f7f9018..81a1e18 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,6 +1,13 @@ // Format date to a string function formatDate(date: Date): string { - const options: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'long', day: 'numeric' }; + 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); } |
