Refactor dateValue initialization in DatePicker.vue
This commit is contained in:
@ -4,7 +4,7 @@ import { onMounted, ref, watch } from 'vue'
|
|||||||
import VueTailwindDatepicker from 'vue-tailwind-datepicker'
|
import VueTailwindDatepicker from 'vue-tailwind-datepicker'
|
||||||
|
|
||||||
const dateValue = ref(
|
const dateValue = ref(
|
||||||
`${new Date().getDay().toString().length == 1 ? `0${new Date().getDay()}` : new Date().getDay()}-${(new Date().getMonth() + 1).toString().length == 1 ? `0${new Date().getMonth() + 1}` : new Date().getMonth() + 1}-${new Date().getFullYear()} s/d ${new Date().getDay().toString().length == 1 ? `0${new Date().getDay()}` : new Date().getDay()}-${(new Date().getMonth() + 1).toString().length == 1 ? `0${new Date().getMonth() + 1}` : new Date().getMonth() + 1}-${new Date().getFullYear()}`
|
`${new Date().getDate().toString().length == 1 ? `0${new Date().getDate()}` : new Date().getDate()}-${(new Date().getMonth() + 1).toString().length == 1 ? `0${new Date().getMonth() + 1}` : new Date().getMonth() + 1}-${new Date().getFullYear()} s/d ${new Date().getDate().toString().length == 1 ? `0${new Date().getDate()}` : new Date().getDate()}-${(new Date().getMonth() + 1).toString().length == 1 ? `0${new Date().getMonth() + 1}` : new Date().getMonth() + 1}-${new Date().getFullYear()}`
|
||||||
)
|
)
|
||||||
const formatter = ref({
|
const formatter = ref({
|
||||||
date: 'DD-MM-YYYY',
|
date: 'DD-MM-YYYY',
|
||||||
@ -79,6 +79,7 @@ watch(dateValue, (newValue) => {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
emit('update:dateValue', dateValue.value)
|
emit('update:dateValue', dateValue.value)
|
||||||
|
console.log('current date', dateValue.value)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user