aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2024-02-05 09:52:51 -0500
committerAndrew Lee <alee14498@protonmail.com>2024-02-05 09:52:51 -0500
commitdfdf64af769b97d2342cf8b3c6fa25106bfb9acf (patch)
treeb8968ce81eee55cc0898c1ed9d1194403b9c3c56 /src
parent97cc04f9d8cba1c06a1587428e4b76d5d58e1801 (diff)
downloadpersonal-website-dfdf64af769b97d2342cf8b3c6fa25106bfb9acf.tar.gz
personal-website-dfdf64af769b97d2342cf8b3c6fa25106bfb9acf.tar.bz2
personal-website-dfdf64af769b97d2342cf8b3c6fa25106bfb9acf.zip
Formatted date
Diffstat (limited to 'src')
-rw-r--r--src/util.ts9
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);
}