diff options
| author | Fuwn <[email protected]> | 2024-02-07 08:17:41 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-02-07 08:17:41 -0800 |
| commit | 8ed60b5ceeacb9b0e24b1fe7bd46fb67a45bdd19 (patch) | |
| tree | b161af99242ee347ba0afaeb98dc86b1062e0087 /src/lib | |
| parent | feat(locale): localise hololive (diff) | |
| download | due.moe-8ed60b5ceeacb9b0e24b1fe7bd46fb67a45bdd19.tar.xz due.moe-8ed60b5ceeacb9b0e24b1fe7bd46fb67a45bdd19.zip | |
feat(locale): localise hololive date formatter
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/Locale/english.ts | 15 | ||||
| -rw-r--r-- | src/lib/Locale/japanese.ts | 16 | ||||
| -rw-r--r-- | src/lib/Locale/layout.ts | 1 |
3 files changed, 30 insertions, 2 deletions
diff --git a/src/lib/Locale/english.ts b/src/lib/Locale/english.ts index 50d0f908..2ae9178b 100644 --- a/src/lib/Locale/english.ts +++ b/src/lib/Locale/english.ts @@ -1,3 +1,5 @@ +import settings from '$stores/settings'; +import { get } from 'svelte/store'; import type { Locale } from './layout'; const English: Locale = { @@ -239,7 +241,18 @@ const English: Locale = { comma: ', ', commaNoSpace: ',', ampersand: '& ', - ended: 'Ended' + ended: 'Ended', + dateFormatter: new Intl.DateTimeFormat('en-US', { + // year: 'numeric', + month: 'long', + day: 'numeric', + // weekday: 'long', + hour: 'numeric', + hour12: !get(settings).display24HourTime, + minute: 'numeric' + // second: 'numeric' + // timeZoneName: 'short' + }).format } }; diff --git a/src/lib/Locale/japanese.ts b/src/lib/Locale/japanese.ts index 3e3fcc35..6010f2bf 100644 --- a/src/lib/Locale/japanese.ts +++ b/src/lib/Locale/japanese.ts @@ -1,4 +1,6 @@ +import { get } from 'svelte/store'; import type { Locale } from './layout'; +import settings from '$stores/settings'; const Japanese: Locale = { navigation: { @@ -241,7 +243,19 @@ const Japanese: Locale = { comma: '、', commaNoSpace: '、', ampersand: '', - ended: '終了' + ended: '終了', + dateFormatter: new Intl.DateTimeFormat('ja-JP', { + // era: 'long', + // year: 'numeric', + month: 'long', + day: 'numeric', + // weekday: 'long', + hour: 'numeric', + hour12: !get(settings).display24HourTime, + minute: 'numeric' + // second: 'numeric' + // timeZoneName: 'short' + }).format } }; diff --git a/src/lib/Locale/layout.ts b/src/lib/Locale/layout.ts index 9d2b84c9..bb9c3c5c 100644 --- a/src/lib/Locale/layout.ts +++ b/src/lib/Locale/layout.ts @@ -241,5 +241,6 @@ export interface Locale { commaNoSpace: LocaleValue; ampersand: LocaleValue; ended: LocaleValue; + dateFormatter: (date?: number | Date | undefined) => string; }; } |