From f8ab133a7dc20562c25a092a402266f5e7b0b296 Mon Sep 17 00:00:00 2001 From: Jack <jack.su@pollex.com.tw> Date: 星期一, 24 一月 2022 10:29:38 +0800 Subject: [PATCH] Merge branch 'Phase3' of ssh://dev.pollex.com.tw:29418/pcalife/PAM into Phase3 --- 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