diff --git a/apps/web-antd/src/views/store/hours/components/AddSlotDrawer.vue b/apps/web-antd/src/views/store/hours/components/AddSlotDrawer.vue index 580267f..585ea77 100644 --- a/apps/web-antd/src/views/store/hours/components/AddSlotDrawer.vue +++ b/apps/web-antd/src/views/store/hours/components/AddSlotDrawer.vue @@ -8,7 +8,7 @@ import type { import type { SlotType } from '#/api/store-hours'; -import { Button, Drawer, Textarea } from 'ant-design-vue'; +import { Button, Drawer, TimePicker } from 'ant-design-vue'; interface Props { addSlotForm: AddSlotFormState; @@ -36,18 +36,35 @@ const emit = defineEmits<{ }>(); function getInputValue(event: Event) { - const target = event.target as HTMLInputElement | null; + const target = event.target as HTMLInputElement | HTMLTextAreaElement | null; return target?.value ?? ''; } + +function hasFormatMethod( + value: unknown, +): value is { format: (pattern: string) => string } { + return Boolean( + value && + typeof value === 'object' && + 'format' in value && + typeof (value as { format?: unknown }).format === 'function', + ); +} + +function readTimeValue(value: unknown) { + if (typeof value === 'string') return value; + if (hasFormatMethod(value)) return value.format('HH:mm'); + return ''; +}