Remove the 14 day selection limit for creating or modifying events.
This commit is contained in:
@@ -258,7 +258,6 @@ watch(
|
|||||||
|
|
||||||
function startDrag(dateStr) {
|
function startDrag(dateStr) {
|
||||||
dateStr = normalizeDate(dateStr)
|
dateStr = normalizeDate(dateStr)
|
||||||
if (calendarStore.config.select_days === 0) return
|
|
||||||
isDragging.value = true
|
isDragging.value = true
|
||||||
dragAnchor.value = dateStr
|
dragAnchor.value = dateStr
|
||||||
selection.value = { startDate: dateStr, dayCount: 1 }
|
selection.value = { startDate: dateStr, dayCount: 1 }
|
||||||
@@ -371,23 +370,13 @@ function getDateFromCoordinates(clientX, clientY) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function calculateSelection(anchorStr, otherStr) {
|
function calculateSelection(anchorStr, otherStr) {
|
||||||
const limit = calendarStore.config.select_days
|
|
||||||
const anchorDate = fromLocalString(anchorStr, DEFAULT_TZ)
|
const anchorDate = fromLocalString(anchorStr, DEFAULT_TZ)
|
||||||
const otherDate = fromLocalString(otherStr, DEFAULT_TZ)
|
const otherDate = fromLocalString(otherStr, DEFAULT_TZ)
|
||||||
const forward = otherDate >= anchorDate
|
const forward = otherDate >= anchorDate
|
||||||
const span = daysInclusive(anchorStr, otherStr)
|
const span = daysInclusive(anchorStr, otherStr)
|
||||||
|
|
||||||
if (span <= limit) {
|
const startDate = forward ? anchorStr : otherStr
|
||||||
const startDate = forward ? anchorStr : otherStr
|
return { startDate, dayCount: span }
|
||||||
return { startDate, dayCount: span }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (forward) {
|
|
||||||
return { startDate: anchorStr, dayCount: limit }
|
|
||||||
} else {
|
|
||||||
const startDate = addDaysStr(anchorStr, -(limit - 1), DEFAULT_TZ)
|
|
||||||
return { startDate, dayCount: limit }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ export const useCalendarStore = defineStore('calendar', {
|
|||||||
_holidayConfigSignature: null,
|
_holidayConfigSignature: null,
|
||||||
_holidaysInitialized: false,
|
_holidaysInitialized: false,
|
||||||
config: {
|
config: {
|
||||||
select_days: 14,
|
|
||||||
first_day: 1,
|
first_day: 1,
|
||||||
holidays: {
|
holidays: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user