smartified start date restrictions to never go earlier than today
This commit is contained in:
@@ -137,7 +137,9 @@ const maxEndDate = computed(() => {
|
|||||||
const minStartDate = computed(() => {
|
const minStartDate = computed(() => {
|
||||||
if (values.type && values.end_date) {
|
if (values.type && values.end_date) {
|
||||||
let endDateObj = new Date(values.end_date.getTime() - values.type.max_length_days * 24 * 60 * 60 * 1000);
|
let endDateObj = new Date(values.end_date.getTime() - values.type.max_length_days * 24 * 60 * 60 * 1000);
|
||||||
return new CalendarDate(endDateObj.getFullYear(), endDateObj.getMonth() + 1, endDateObj.getDate())
|
let td = today(getLocalTimeZone());
|
||||||
|
let start = new CalendarDate(endDateObj.getFullYear(), endDateObj.getMonth() + 1, endDateObj.getDate())
|
||||||
|
return td.compare(start) > 0 ? td : start;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -258,7 +260,8 @@ const filteredMembers = computed(() => {
|
|||||||
<PopoverContent class="w-auto p-0">
|
<PopoverContent class="w-auto p-0">
|
||||||
<Calendar
|
<Calendar
|
||||||
@update:model-value="(val: CalendarDate) => field.onChange(val.toDate(getLocalTimeZone()))"
|
@update:model-value="(val: CalendarDate) => field.onChange(val.toDate(getLocalTimeZone()))"
|
||||||
layout="month-and-year" :min-value="minStartDate || today(getLocalTimeZone())" />
|
layout="month-and-year"
|
||||||
|
:min-value="minStartDate || today(getLocalTimeZone())" />
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
<div class="h-4">
|
<div class="h-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user