From ac7e2ecb59e2ad8c29bca52fca4e4d9b316403c5 Mon Sep 17 00:00:00 2001 From: KOKO Date: Sun, 12 Feb 2023 08:23:14 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BA=83=E5=91=8A=E3=81=AEexpiresAt?= =?UTF-8?q?=E3=82=92LocalTZ=E5=88=86=E3=81=9A=E3=82=89=E3=81=97=E3=81=A6?= =?UTF-8?q?=E5=88=9D=E6=9C=9F=E5=8C=96=20(#9876)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 広告のexpiresAtをLocalTZ分ずらして初期化 * chore: 不要なインポートを削除 --- packages/frontend/src/pages/admin/ads.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/pages/admin/ads.vue b/packages/frontend/src/pages/admin/ads.vue index 4d6f32f9a9..701ec31b65 100644 --- a/packages/frontend/src/pages/admin/ads.vue +++ b/packages/frontend/src/pages/admin/ads.vue @@ -60,11 +60,17 @@ import { definePageMetadata } from '@/scripts/page-metadata'; let ads: any[] = $ref([]); +// ISO形式はTZがUTCになってしまうので、TZ分ずらして時間を初期化 +const localTime = new Date(); +const localTimeDiff = localTime.getTimezoneOffset() * 60 * 1000; + os.api('admin/ad/list').then(adsResponse => { ads = adsResponse.map(r => { + const date = new Date(r.expiresAt); + date.setMilliseconds(date.getMilliseconds() - localTimeDiff); return { ...r, - expiresAt: new Date(r.expiresAt).toISOString().slice(0, 16), + expiresAt: date.toISOString().slice(0, 16), }; }); });