This commit is contained in:
Leo Vasanko 2025-08-23 18:38:25 -06:00
parent 0a80d364f1
commit b4b14a695b

View File

@ -5,10 +5,6 @@ import {
getLocaleWeekendDays, getLocaleWeekendDays,
getMondayOfISOWeek, getMondayOfISOWeek,
getOccurrenceIndex, getOccurrenceIndex,
getWeeklyOccurrenceIndex,
getMonthlyOccurrenceIndex,
getVirtualOccurrenceEndDate,
occursOnOrSpansDate,
} from '@/utils/date' } from '@/utils/date'
import { import {
initializeHolidays, initializeHolidays,
@ -16,7 +12,6 @@ import {
isHoliday, isHoliday,
getAvailableCountries, getAvailableCountries,
getAvailableStates, getAvailableStates,
getHolidayConfig,
} from '@/utils/holidays' } from '@/utils/holidays'
const MIN_YEAR = 1900 const MIN_YEAR = 1900
@ -164,23 +159,11 @@ export const useCalendarStore = defineStore('calendar', {
}, },
getAvailableCountries() { getAvailableCountries() {
try { return getAvailableCountries() || []
const countries = getAvailableCountries()
return Array.isArray(countries) ? countries : ['US', 'GB', 'DE', 'FR', 'CA', 'AU']
} catch (error) {
console.warn('Failed to get available countries:', error)
return ['US', 'GB', 'DE', 'FR', 'CA', 'AU']
}
}, },
getAvailableStates(country) { getAvailableStates(country) {
try { return getAvailableStates(country) || []
const states = getAvailableStates(country)
return Array.isArray(states) ? states : []
} catch (error) {
console.warn('Failed to get available states for', country, error)
return []
}
}, },
toggleHolidays() { toggleHolidays() {
@ -508,10 +491,6 @@ export const useCalendarStore = defineStore('calendar', {
this.deleteEvent(baseId) this.deleteEvent(baseId)
return return
} }
// We want to keep occurrences up to but NOT including the selected one
// occurrenceIndex represents the occurrence index including the base (0=base, 1=first repeat, etc.)
// To exclude the current occurrence and everything after, we keep only occurrenceIndex total occurrences
const keptTotal = occurrenceIndex const keptTotal = occurrenceIndex
this._terminateRepeatSeriesAtIndex(baseId, keptTotal) this._terminateRepeatSeriesAtIndex(baseId, keptTotal)
}, },
@ -597,13 +576,6 @@ export const useCalendarStore = defineStore('calendar', {
return base.id return base.id
}, },
_snapshotBaseEvent(eventId) {
const ev = this.events.get(eventId)
return ev ? { ...ev } : null
},
// expandRepeats removed: no physical occurrence expansion
// Adjust start/end range of a base event (non-generated) and reindex occurrences // Adjust start/end range of a base event (non-generated) and reindex occurrences
setEventRange(eventId, newStartStr, newEndStr, { mode = 'auto' } = {}) { setEventRange(eventId, newStartStr, newEndStr, { mode = 'auto' } = {}) {
const snapshot = this.events.get(eventId) const snapshot = this.events.get(eventId)