From 2030f27d4a0ef0b3795a46b9c56160812a947039 Mon Sep 17 00:00:00 2001 From: masky5859 Date: Fri, 13 Dec 2024 22:25:41 +0900 Subject: [PATCH] =?UTF-8?q?fix:=E6=97=A5=E4=BB=98=E3=81=AEautofill?= =?UTF-8?q?=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 | 27 +++---------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/components/event/EventFormTimeAndPlaceInstant.vue b/src/components/event/EventFormTimeAndPlaceInstant.vue index 0aeb91f1..c5ebe75b 100644 --- a/src/components/event/EventFormTimeAndPlaceInstant.vue +++ b/src/components/event/EventFormTimeAndPlaceInstant.vue @@ -76,8 +76,6 @@ export default class EventFormTimeAndPlaceInstant extends Vue { private dateEndMem = '' private timeStartMem = '' private timeEndMem = '' - private yearDiff = 0 - private monthDiff = 0 private dateDiff = 0 private hourDiff = 1 private minuteDiff = 0 @@ -131,16 +129,11 @@ export default class EventFormTimeAndPlaceInstant extends Vue { public autoFillDateEnd() { if (!this.dateEndMem) { - this.dateEndMem = this.dateStartMem - this.yearDiff = 0 - this.monthDiff = 0 this.dateDiff = 0 + this.dateEndMem = this.dateStartMem } else { - const startDate = new Date(this.dateStartMem) - const endDate = new Date(this.dateEndMem) - - endDate.setFullYear(startDate.getFullYear() + this.yearDiff) - endDate.setMonth(startDate.getMonth() + this.monthDiff) + let startDate = new Date(this.dateStartMem) + let endDate = startDate endDate.setDate(startDate.getDate() + this.dateDiff) this.dateEndMem = endDate.toISOString().split('T')[0] } @@ -171,20 +164,6 @@ export default class EventFormTimeAndPlaceInstant extends Vue { if (this.dateStartMem && this.dateEndMem) { const startDate = new Date(this.dateStartMem) const endDate = new Date(this.dateEndMem) - - this.yearDiff = endDate.getFullYear() - startDate.getFullYear() - if (this.yearDiff < 0) { - this.yearDiff = 0 - } - - this.monthDiff = - endDate.getMonth() - - startDate.getMonth() + - 12 * (endDate.getFullYear() - startDate.getFullYear()) - if (this.monthDiff < 0) { - this.monthDiff = 0 - } - this.dateDiff = Math.floor( (endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24) )