From c3a36698e5e57418d791c2a77f7fdda284b76e5d Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 1 Jan 2023 17:11:33 +0900 Subject: use Intl.DateTimeFormat and Intl.NumberFormat instead of toLocaleString (#9444) --- packages/frontend/src/scripts/intl-const.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 packages/frontend/src/scripts/intl-const.ts (limited to 'packages/frontend/src/scripts') diff --git a/packages/frontend/src/scripts/intl-const.ts b/packages/frontend/src/scripts/intl-const.ts new file mode 100644 index 0000000000..081ff6248c --- /dev/null +++ b/packages/frontend/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); -- cgit v1.2.3-freya