Refactor code for improved performance and readability
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { PhCalendarBlank } from '@phosphor-icons/vue'
|
||||
import { ref, watch } from 'vue'
|
||||
|
||||
import VueTailwindDatepicker from 'vue-tailwind-datepicker'
|
||||
|
||||
const dateValue = ref('')
|
||||
@ -9,27 +8,27 @@ const formatter = ref({
|
||||
date: 'DD-MM-YYYY',
|
||||
month: 'MMMM'
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:dateValue'])
|
||||
|
||||
const customShortcuts = () => {
|
||||
return [
|
||||
{
|
||||
label: "Last 15 Days",
|
||||
label: 'Last 15 Days',
|
||||
atClick: () => {
|
||||
const date = new Date();
|
||||
return [new Date(date.setDate(date.getDate() + 1)), date];
|
||||
},
|
||||
const date = new Date()
|
||||
return [new Date(date.setDate(date.getDate() + 1)), date]
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Last Years",
|
||||
label: 'Last Years',
|
||||
atClick: () => {
|
||||
const date = new Date();
|
||||
return [new Date(date.setFullYear(date.getFullYear() - 1)), new Date()];
|
||||
},
|
||||
},
|
||||
|
||||
];
|
||||
};
|
||||
const date = new Date()
|
||||
return [new Date(date.setFullYear(date.getFullYear() - 1)), new Date()]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
watch(dateValue, (newValue) => {
|
||||
emit('update:dateValue', newValue)
|
||||
})
|
||||
|
Reference in New Issue
Block a user