diff --git a/src/front/src/components/calendar_of_events/UI_calendar/timeSelect.vue b/src/front/src/components/calendar_of_events/UI_calendar/timeSelect.vue index 7e3f9c21c..ea33ecbbf 100644 --- a/src/front/src/components/calendar_of_events/UI_calendar/timeSelect.vue +++ b/src/front/src/components/calendar_of_events/UI_calendar/timeSelect.vue @@ -42,11 +42,7 @@ :min=" order[0] == 2 ? false - : new Date( - new Date(limitation).setDate( - new Date(limitation).getDate() - 1 - ) - ) + : minData() " /> @@ -141,16 +137,32 @@ export default { const creatwdDate = (date, time) => { if (props.order[0] == 4) { - props.limitation; - propsDateEvent.value = - new Date(formatDash(date) + "T" + time) >= props.limitation - ? new Date(formatDash(date) + "T" + time) - : props.limitation; + if (time == "0:00") { + propsDateEvent.value = date; + } else if ( + new Date(formatDash(date) + "T" + time) >= new Date(props.limitation) + ) { + propsDateEvent.value = new Date(formatDash(date) + "T" + time); + } else { + propsDateEvent.value = props.limitation; + } } else { - propsDateEvent.value = new Date(formatDash(date) + "T" + time); + propsDateEvent.value = + time == "0:00" ? date : new Date(formatDash(date) + "T" + time); } }; + const minData = () => { + let h = `${new Date(props.limitation).getHours()}:${String( + new Date(props.limitation).getMinutes() + ).padStart(2, "0")}` + let min = + h == '0:00'? + new Date(props.limitation) : + new Date(new Date(props.limitation).setDate(new Date(props.limitation).getDate() - 1)) + return new Date(min) + } + return { propsDateEvent, menudate, @@ -158,6 +170,7 @@ export default { modelDate, formatComa, timeEvent, + minData }; }, };