Skip to content

Commit

Permalink
fix:編集時に日時情報が抜ける問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
mathsuky committed Aug 15, 2024
1 parent 32726f4 commit 969aef2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/components/event/EventFormTimeAndPlaceInstant.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -95,7 +102,7 @@ export default class EventFormTimeAndPlaceInstant extends Vue {
}
}
private setDefaultDateEnd() {
public setDefaultDateEnd() {
if (!this.dateEndMem) this.dateEndMem = this.dateStartMem
}
Expand Down
15 changes: 15 additions & 0 deletions src/workers/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 969aef2

Please sign in to comment.