From a6a8a7fb8505004bf77b36b521e8897443e5a9c0 Mon Sep 17 00:00:00 2001
From: KOKO <kokoa@ciebus.net>
Date: Thu, 9 Feb 2023 17:54:30 +0900
Subject: [PATCH] =?UTF-8?q?fix:=20date=E3=81=AE=E5=88=9D=E6=9C=9F=E5=80=A4?=
 =?UTF-8?q?=E3=81=8C=E6=AD=A3=E5=B8=B8=E3=81=AB=E5=85=A5=E3=82=89=E3=81=AA?=
 =?UTF-8?q?=E3=81=84=E6=99=82=E3=81=8C=E3=81=82=E3=82=8B=20(#9827)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* fix: dateの初期値が正常に入らない時がある

* feat: datettime-localをとれるように

* chore: いらない差分を戻す
---
 packages/frontend/src/components/MkInput.vue | 2 +-
 packages/frontend/src/pages/admin/ads.vue    | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/packages/frontend/src/components/MkInput.vue b/packages/frontend/src/components/MkInput.vue
index 5c5151fce6..e3f68caa9b 100644
--- a/packages/frontend/src/components/MkInput.vue
+++ b/packages/frontend/src/components/MkInput.vue
@@ -42,7 +42,7 @@ import { i18n } from '@/i18n';
 
 const props = defineProps<{
 	modelValue: string | number;
-	type?: 'text' | 'number' | 'password' | 'email' | 'url' | 'date' | 'time' | 'search';
+	type?: 'text' | 'number' | 'password' | 'email' | 'url' | 'date' | 'time' | 'search' | 'datetime-local';
 	required?: boolean;
 	readonly?: boolean;
 	disabled?: boolean;
diff --git a/packages/frontend/src/pages/admin/ads.vue b/packages/frontend/src/pages/admin/ads.vue
index 5f711e3e4f..4d6f32f9a9 100644
--- a/packages/frontend/src/pages/admin/ads.vue
+++ b/packages/frontend/src/pages/admin/ads.vue
@@ -29,7 +29,7 @@
 					<MkInput v-model="ad.ratio" type="number">
 						<template #label>{{ i18n.ts.ratio }}</template>
 					</MkInput>
-					<MkInput v-model="ad.expiresAt" type="date">
+					<MkInput v-model="ad.expiresAt" type="datetime-local">
 						<template #label>{{ i18n.ts.expiration }}</template>
 					</MkInput>
 				</FormSplit>
@@ -61,7 +61,12 @@ import { definePageMetadata } from '@/scripts/page-metadata';
 let ads: any[] = $ref([]);
 
 os.api('admin/ad/list').then(adsResponse => {
-	ads = adsResponse;
+	ads = adsResponse.map(r => {
+		return {
+			...r,
+			expiresAt: new Date(r.expiresAt).toISOString().slice(0, 16),
+		};
+	});
 });
 
 function add() {