날짜 min
This commit is contained in:
parent
c2bac1c3fb
commit
2f1464bf6b
@ -8,7 +8,7 @@
|
||||
{{ title }}
|
||||
</h5>
|
||||
<p v-if="isProjectExpired" class="btn-icon btn-danger rounded-2"><i class='bx bx-power-off'></i></p>
|
||||
<div v-if="!isProjectExpired">
|
||||
<div v-if="!isProjectExpired" class="d-flex gap-1">
|
||||
<EditBtn @click.stop="openEditModal" />
|
||||
<DeleteBtn v-if="isProjectCreator" @click.stop="handleDelete" class="ms-1"/>
|
||||
</div>
|
||||
@ -128,6 +128,7 @@
|
||||
title="종료일"
|
||||
type="date"
|
||||
name="endDay"
|
||||
:min="todays"
|
||||
:modelValue="selectedProject.PROJCTEND"
|
||||
@update:modelValue="selectedProject.PROJCTEND = $event"
|
||||
/>
|
||||
@ -160,7 +161,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineProps, onMounted, ref, computed, watch } from 'vue';
|
||||
import { defineProps, onMounted, ref, computed, watch, inject } from 'vue';
|
||||
import UserList from '@c/user/UserList.vue';
|
||||
import CenterModal from '@c/modal/CenterModal.vue';
|
||||
import $api from '@api';
|
||||
@ -253,6 +254,12 @@ const isProjectCreator = computed(() => {
|
||||
return user.value?.id === props.projctCreatorId;
|
||||
});
|
||||
|
||||
// dayjs 인스턴스 가져오기
|
||||
const dayjs = inject('dayjs');
|
||||
|
||||
// 오늘 날짜를 YYYY-MM-DD 형식으로 변환
|
||||
const todays = dayjs().format('YYYY-MM-DD');
|
||||
|
||||
// 프로젝트 만료 여부 체크 (종료일이 지났는지)
|
||||
const isProjectExpired = computed(() => {
|
||||
if (!props.enddate) return false;
|
||||
@ -356,19 +363,6 @@ const hasChanges = computed(() => {
|
||||
selectedProject.value.PROJCTDES !== props.description ||
|
||||
selectedProject.value.PROJCTCOL !== props.projctCol;
|
||||
});
|
||||
// 종료일이 시작일보다 이전 날짜라면 종료일을 시작일로 맞추기
|
||||
watch(
|
||||
() => selectedProject.value,
|
||||
() => {
|
||||
const start = new Date(selectedProject.value.PROJCTSTR);
|
||||
const end = new Date(selectedProject.value.PROJCTEND);
|
||||
|
||||
if (end < start) {
|
||||
selectedProject.value.PROJCTEND = selectedProject.value.PROJCTSTR;
|
||||
}
|
||||
},
|
||||
{ deep: true, flush: 'post' }
|
||||
);
|
||||
|
||||
// 프로젝트 수정
|
||||
const handleUpdate = () => {
|
||||
|
||||
@ -69,6 +69,7 @@
|
||||
:type="'date'"
|
||||
name="endDay"
|
||||
:modelValue="endDay"
|
||||
:min = "today"
|
||||
@update:modelValue="endDay = $event"
|
||||
/>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user