|  | @@ -1,7 +1,7 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  |    <div>
 | 
	
		
			
				|  |  |      <el-date-picker
 | 
	
		
			
				|  |  | -      v-model="dateRangeValue"
 | 
	
		
			
				|  |  | +      v-model="dateRange"
 | 
	
		
			
				|  |  |        type="daterange"
 | 
	
		
			
				|  |  |        unlink-panels
 | 
	
		
			
				|  |  |        range-separator="To"
 | 
	
	
		
			
				|  | @@ -13,23 +13,41 @@
 | 
	
		
			
				|  |  |        :disabled-date="disabledDate"
 | 
	
		
			
				|  |  |        :clearable="false"
 | 
	
		
			
				|  |  |        :popper-options="{placement: props.popperPlacement}"
 | 
	
		
			
				|  |  | -      @change="$emit('change', dateRangeValue)"
 | 
	
		
			
				|  |  | +      @change="changedValue"
 | 
	
		
			
				|  |  |      />
 | 
	
		
			
				|  |  |    </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script setup lang="ts">
 | 
	
		
			
				|  |  | -import { ref } from 'vue'
 | 
	
		
			
				|  |  | +import { ref, onMounted } from 'vue'
 | 
	
		
			
				|  |  |  import dayjs, { Dayjs } from 'dayjs'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +defineOptions({
 | 
	
		
			
				|  |  | +  name: 'DateRangePicker'
 | 
	
		
			
				|  |  | +})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const props = defineProps({
 | 
	
		
			
				|  |  | +  modelValue: {type: Array, required: true },
 | 
	
		
			
				|  |  |    timezone: { type: String, required: true },
 | 
	
		
			
				|  |  |    popperPlacement: { type: String, default: 'bottom-start' }
 | 
	
		
			
				|  |  |  })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const dateRangeValue = ref(['2023-10-01', '2023-10-10'])
 | 
	
		
			
				|  |  | +const dateRange = ref(props.modelValue)
 | 
	
		
			
				|  |  | +const emits = defineEmits(['update:modelValue', 'change'])
 | 
	
		
			
				|  |  | +const changedValue = (newVal: string[]) => {
 | 
	
		
			
				|  |  | +  emits('update:modelValue', newVal)
 | 
	
		
			
				|  |  | +  emits('change', newVal)
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +// onMounted(() => {
 | 
	
		
			
				|  |  | +//   if(dateRange.value.length === 0 && props.defaultRecentDay > 0) {
 | 
	
		
			
				|  |  | +//     const now_tz = dayjs(new Date()).tz(props.timezone)
 | 
	
		
			
				|  |  | +//     const start = now_tz.subtract(props.defaultRecentDay, 'day')
 | 
	
		
			
				|  |  | +//     const end = now_tz.subtract(1, 'day')
 | 
	
		
			
				|  |  | +//     dateRange.value = [start.format("YYYY-MM-DD"), end.format("YYYY-MM-DD")]
 | 
	
		
			
				|  |  | +//     emits('update:modelValue', dateRange.value)
 | 
	
		
			
				|  |  | +//   }
 | 
	
		
			
				|  |  | +// })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  function disabledDate(datetime: Date) {
 | 
	
		
			
				|  |  |    const now = dayjs(new Date()).tz(props.timezone)
 |