Closed khems closed 1 year ago
If minimumView is set to 'time' and pageDate is already set, changing the date through the date picker only allows changes of time.
Steps to reproduce:
<datepicker v-model="pickerStartDate" :inputFormat="dd/MM/yyyy HH:mm" minimumView="time" />
Select a date and time - first selection works. Then select another and it'll keep the date the same and not change the time.
I've isolated the problem to https://github.com/icehaunter/vue3-datepicker/blob/9f21b007ccc4f5f61f2181f9548735d14aac2f38/src/datepicker/Timepicker.vue#L107
--- a/src/datepicker/Timepicker.vue +++ b/src/datepicker/Timepicker.vue @@ -104,7 +104,7 @@ export default defineComponent({ const hoursListRef = ref(null as HTMLElement | null) const minutesListRef = ref(null as HTMLElement | null) - const currentDate = computed(() => props.selected ?? props.pageDate) + const currentDate = computed(() => props.pageDate ?? props.selected) const hours = ref(currentDate.value.getHours()) const minutes = ref(currentDate.value.getMinutes())
props.selected and props.pageDate are the wrong way around.
props.selected
props.pageDate
I've submitted a pull request to fix this https://github.com/icehaunter/vue3-datepicker/pull/87
If minimumView is set to 'time' and pageDate is already set, changing the date through the date picker only allows changes of time.
Steps to reproduce:
Select a date and time - first selection works. Then select another and it'll keep the date the same and not change the time.
Fix
I've isolated the problem to https://github.com/icehaunter/vue3-datepicker/blob/9f21b007ccc4f5f61f2181f9548735d14aac2f38/src/datepicker/Timepicker.vue#L107
props.selected
andprops.pageDate
are the wrong way around.I've submitted a pull request to fix this https://github.com/icehaunter/vue3-datepicker/pull/87