From c3a36698e5e57418d791c2a77f7fdda284b76e5d Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 1 Jan 2023 17:11:33 +0900 Subject: [PATCH] use Intl.DateTimeFormat and Intl.NumberFormat instead of toLocaleString (#9444) --- packages/frontend/src/components/MkAbuseReport.vue | 3 ++- packages/frontend/src/components/MkChart.vue | 3 ++- .../frontend/src/components/MkFileListForAdmin.vue | 3 ++- packages/frontend/src/components/MkUrlPreview.vue | 7 +++---- packages/frontend/src/components/MkYoutubePlayer.vue | 6 ++---- packages/frontend/src/components/global/MkTime.vue | 3 ++- packages/frontend/src/filters/date.ts | 4 ++++ packages/frontend/src/filters/number.ts | 4 +++- packages/frontend/src/pages/about.federation.vue | 3 ++- packages/frontend/src/pages/admin/users.vue | 3 ++- packages/frontend/src/pages/instance-info.vue | 3 ++- packages/frontend/src/pages/note.vue | 3 ++- packages/frontend/src/pages/user/home.vue | 3 ++- packages/frontend/src/scripts/intl-const.ts | 12 ++++++++++++ 14 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 packages/frontend/src/filters/date.ts create mode 100644 packages/frontend/src/scripts/intl-const.ts diff --git a/packages/frontend/src/components/MkAbuseReport.vue b/packages/frontend/src/components/MkAbuseReport.vue index 9a3464b64..c06579288 100644 --- a/packages/frontend/src/components/MkAbuseReport.vue +++ b/packages/frontend/src/components/MkAbuseReport.vue @@ -10,7 +10,7 @@ - +
@@ -42,6 +42,7 @@ import MkKeyValue from '@/components/MkKeyValue.vue'; import { acct, userPage } from '@/filters/user'; import * as os from '@/os'; import { i18n } from '@/i18n'; +import { dateString } from '@/filters/date'; const props = defineProps<{ report: any; diff --git a/packages/frontend/src/components/MkChart.vue b/packages/frontend/src/components/MkChart.vue index 94cffa12c..d99a5478e 100644 --- a/packages/frontend/src/components/MkChart.vue +++ b/packages/frontend/src/components/MkChart.vue @@ -40,6 +40,7 @@ import { defaultStore } from '@/store'; import { useChartTooltip } from '@/scripts/use-chart-tooltip'; import { chartVLine } from '@/scripts/chart-vline'; import { alpha } from '@/scripts/color'; +import date from '@/filters/date'; const props = defineProps({ src: { @@ -171,7 +172,7 @@ const render = () => { chartInstance = new Chart(chartEl.value, { type: props.bar ? 'bar' : 'line', data: { - labels: new Array(props.limit).fill(0).map((_, i) => getDate(i).toLocaleString()).slice().reverse(), + labels: new Array(props.limit).fill(0).map((_, i) => date(getDate(i))).slice().reverse(), datasets: chartData.series.map((x, i) => ({ parsing: false, label: x.name, diff --git a/packages/frontend/src/components/MkFileListForAdmin.vue b/packages/frontend/src/components/MkFileListForAdmin.vue index 4910506a9..1335f88a7 100644 --- a/packages/frontend/src/components/MkFileListForAdmin.vue +++ b/packages/frontend/src/components/MkFileListForAdmin.vue @@ -4,7 +4,7 @@ @@ -39,6 +39,7 @@ import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue'; import bytes from '@/filters/bytes'; import * as os from '@/os'; import { i18n } from '@/i18n'; +import { dateString } from '@/filters/date'; const props = defineProps<{ pagination: any; diff --git a/packages/frontend/src/components/MkUrlPreview.vue b/packages/frontend/src/components/MkUrlPreview.vue index f8484e38a..6b38080f9 100644 --- a/packages/frontend/src/components/MkUrlPreview.vue +++ b/packages/frontend/src/components/MkUrlPreview.vue @@ -45,11 +45,12 @@