From 969aef23da80205afaedb7c4576b7c0bd0c0aea3 Mon Sep 17 00:00:00 2001 From: masky5859 Date: Thu, 15 Aug 2024 17:36:04 +0900 Subject: [PATCH] =?UTF-8?q?fix:=E7=B7=A8=E9=9B=86=E6=99=82=E3=81=AB?= =?UTF-8?q?=E6=97=A5=E6=99=82=E6=83=85=E5=A0=B1=E3=81=8C=E6=8A=9C=E3=81=91?= =?UTF-8?q?=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/EventFormTimeAndPlaceInstant.vue | 17 ++++++++++++----- src/workers/rules.ts | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/components/event/EventFormTimeAndPlaceInstant.vue b/src/components/event/EventFormTimeAndPlaceInstant.vue index 9344a05b..2ca8d903 100644 --- a/src/components/event/EventFormTimeAndPlaceInstant.vue +++ b/src/components/event/EventFormTimeAndPlaceInstant.vue @@ -69,10 +69,17 @@ export default class EventFormTimeAndPlaceInstant extends Vue { @Prop({ type: Boolean, required: true }) value!: boolean - private dateStartMem = '' - private dateEndMem = '' - private timeStartMem = '' - private timeEndMem = '' + public dateStartMem = '' + public dateEndMem = '' + public timeStartMem = '' + public timeEndMem = '' + + created() { + this.dateStartMem = this.timeStartInput && getDate(this.timeStartInput) + this.dateEndMem = this.timeEndInput && getDate(this.timeEndInput) + this.timeStartMem = this.timeStartInput && getTime(this.timeStartInput) + this.timeEndMem = this.timeEndInput && getTime(this.timeEndInput) + } @Ref() readonly form!: { validate(): void } @@ -95,7 +102,7 @@ export default class EventFormTimeAndPlaceInstant extends Vue { } } - private setDefaultDateEnd() { + public setDefaultDateEnd() { if (!this.dateEndMem) this.dateEndMem = this.dateStartMem } diff --git a/src/workers/rules.ts b/src/workers/rules.ts index c36ece88..d93d8006 100644 --- a/src/workers/rules.ts +++ b/src/workers/rules.ts @@ -60,6 +60,21 @@ const rules = { startTime < endTime || '終了日時が開始日時よりも遅くなるようにしてください', ], + eventTimeInstant2: ( + startDate: string, + startTime: string, + endDate: string, + endTime: string + ) => [ + () => + !startDate || + !startTime || + !endDate || + !endTime || + new Date(startDate + 'T' + startTime) < + new Date(endDate + 'T' + endTime) || + '終了日時が開始日時よりも遅くなるようにしてください', + ], } export default rules