<!-- DateSearch.vue -->
<template>
  <div>
    <label for="start-date">시작 날짜:</label>
    <input type="date" v-model="startDate" id="start-date" />

    <label for="end-date">종료 날짜:</label>
    <input type="date" v-model="endDate" id="end-date" />

    <button @click="searchData">검색</button>
  </div>
</template>

<script setup>
import { ref, onMounted, defineEmits } from 'vue';

const startDate = ref('');
const endDate = ref('');
const emit = defineEmits(['search']);
const searchData = () => {
  emit('search', { startDate: startDate.value, endDate: endDate.value });
};

const today = new Date();
const tomorrow = new Date();
tomorrow.setDate(today.getDate() + 1);
startDate.value = formatDate(today);
endDate.value = formatDate(tomorrow);

function formatDate(date) {
  return date.toISOString().split('T')[0];
}
</script>

<style scoped>
/* 필요한 스타일 */
</style>
