diff options
| author | tamaina <tamaina@hotmail.co.jp> | 2022-06-21 07:49:52 +0000 |
|---|---|---|
| committer | tamaina <tamaina@hotmail.co.jp> | 2022-06-21 07:49:52 +0000 |
| commit | f33654fb9ae562a43745b612a3007c248d988f2b (patch) | |
| tree | 25b8599f7d28bf02cd0d3970b735d9db5e84742b /packages/client/src/scripts/format-time-string.ts | |
| parent | Merge branch 'develop' into pizzax-indexeddb (diff) | |
| parent | refactor(client): use composition api (diff) | |
| download | sharkey-f33654fb9ae562a43745b612a3007c248d988f2b.tar.gz sharkey-f33654fb9ae562a43745b612a3007c248d988f2b.tar.bz2 sharkey-f33654fb9ae562a43745b612a3007c248d988f2b.zip | |
Merge branch 'develop' into pizzax-indexeddb
Diffstat (limited to 'packages/client/src/scripts/format-time-string.ts')
| -rw-r--r-- | packages/client/src/scripts/format-time-string.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/client/src/scripts/format-time-string.ts b/packages/client/src/scripts/format-time-string.ts index bfb2c397ae..fb4718c007 100644 --- a/packages/client/src/scripts/format-time-string.ts +++ b/packages/client/src/scripts/format-time-string.ts @@ -13,7 +13,7 @@ const defaultLocaleStringFormats: {[index: string]: string} = { function formatLocaleString(date: Date, format: string): string { return format.replace(/\{\{(\w+)(:(\w+))?\}\}/g, (match: string, kind: string, unused?, option?: string) => { if (['weekday', 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeZoneName'].includes(kind)) { - return date.toLocaleString(window.navigator.language, {[kind]: option ? option : defaultLocaleStringFormats[kind]}); + return date.toLocaleString(window.navigator.language, { [kind]: option ? option : defaultLocaleStringFormats[kind] }); } else { return match; } @@ -24,8 +24,8 @@ export function formatDateTimeString(date: Date, format: string): string { return format .replace(/yyyy/g, date.getFullYear().toString()) .replace(/yy/g, date.getFullYear().toString().slice(-2)) - .replace(/MMMM/g, date.toLocaleString(window.navigator.language, { month: 'long'})) - .replace(/MMM/g, date.toLocaleString(window.navigator.language, { month: 'short'})) + .replace(/MMMM/g, date.toLocaleString(window.navigator.language, { month: 'long' })) + .replace(/MMM/g, date.toLocaleString(window.navigator.language, { month: 'short' })) .replace(/MM/g, (`0${date.getMonth() + 1}`).slice(-2)) .replace(/M/g, (date.getMonth() + 1).toString()) .replace(/dd/g, (`0${date.getDate()}`).slice(-2)) |