From c462d48bdbcf81aef376464c17b367f0d61a9958 Mon Sep 17 00:00:00 2001 From: tamania Date: Fri, 23 Jun 2023 18:33:37 -0700 Subject: [PATCH] =?UTF-8?q?perf:=20=E2=9A=A1=20use=20setInterval=20instead?= =?UTF-8?q?=20of=20setTimeout=20chain=20in=20MkTime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/src/components/global/MkTime.vue | 69 +++++++++++++------ packages/client/src/scripts/intl-const.ts | 12 ++++ 2 files changed, 60 insertions(+), 21 deletions(-) create mode 100644 packages/client/src/scripts/intl-const.ts diff --git a/packages/client/src/components/global/MkTime.vue b/packages/client/src/components/global/MkTime.vue index 5d9295433..72a51f10d 100644 --- a/packages/client/src/components/global/MkTime.vue +++ b/packages/client/src/components/global/MkTime.vue @@ -1,21 +1,23 @@ diff --git a/packages/client/src/scripts/intl-const.ts b/packages/client/src/scripts/intl-const.ts new file mode 100644 index 000000000..ac7372371 --- /dev/null +++ b/packages/client/src/scripts/intl-const.ts @@ -0,0 +1,12 @@ +import { lang } from "@/config"; + +export const versatileLang = (lang ?? "ja-JP").replace("ja-KS", "ja-JP"); +export const dateTimeFormat = new Intl.DateTimeFormat(versatileLang, { + year: "numeric", + month: "numeric", + day: "numeric", + hour: "numeric", + minute: "numeric", + second: "numeric", +}); +export const numberFormat = new Intl.NumberFormat(versatileLang);