From a973040ec6b1d92b1440132d77fe41072585c1a0 Mon Sep 17 00:00:00 2001 From: Mila <Mila@pollex.com.tw> Date: 星期六, 22 一月 2022 11:40:46 +0800 Subject: [PATCH] fixed TODO#134578 約訪通知 : 預計約訪時段不可選擇過去時間 --- PAMapp/components/DateTimePicker.vue | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/PAMapp/components/DateTimePicker.vue b/PAMapp/components/DateTimePicker.vue index 7916c77..f2a8763 100644 --- a/PAMapp/components/DateTimePicker.vue +++ b/PAMapp/components/DateTimePicker.vue @@ -4,25 +4,31 @@ <div class="dateTime"> <UiDatePicker @changeDate="changeDateTime($event, 'date')" + :isPastDateDisabled="isPastDateDisabled" :defaultValue="defaultValue" ></UiDatePicker> <UiTimePicker @changeTime="changeDateTime($event, 'time')" :defaultValue="defaultValue" + :isPastDateDisabled="isPastDateDisabled" + :changeDate="changeDate" ></UiTimePicker> </div> </template> <script lang="ts"> -import { Component, Emit, Prop, Vue } from "nuxt-property-decorator"; +import { Component, Emit, Prop, Vue, Watch } from "nuxt-property-decorator"; @Component export default class DateTimePicker extends Vue { - changeDate!: Date; + changeDate: Date | string = ''; changeTime!: string; @Prop() defaultValue!: string; + + @Prop() + isPastDateDisabled!: boolean; @Emit('changeDateTime') changeDateTime(event, type) { @@ -33,12 +39,14 @@ this.changeTime = event; } if (this.changeDate && this.changeTime) { - const timeArray = this.changeTime.split(':'); - const interViewTime = this.changeDate.setHours(+timeArray[0], +timeArray[1]); + const hour = this.changeTime.split(':')[0]; + const minute = this.changeTime.split(':')[1]; + const interViewTime = new Date(this.changeDate).setHours(+hour, +minute); return new Date(interViewTime); } return ''; } + } </script> -- Gitblit v1.8.0