refactor: high-cohesion low-coupling cleanup across store and components
ical-io.js: - Import pad2/parseISODate from date.js (remove local duplicates) - Rename ICAL.Time helpers to icalTimeTo* for clarity useCalendar.js: - Delegate addEvent to createEvent() factory - Delegate splitEvent to splitRecurringEvent() pure function - Use cloneEvent() instead of JSON.parse(JSON.stringify()) - Add selectEvent() action (components no longer mutate state.selectedUid directly) Components: - EventList: use selectEvent action + toDate() from date.js - HeaderBar: destructure loadFile at top level (was re-calling useCalendar in handler) - EventDetail: import DOW from weekday.js (was inlining the array) - OccurrenceGrid: use toDate() from date.js
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { DOW } from '../lib/weekday.js'
|
||||
import { toDate } from '../lib/date.js'
|
||||
import { expandOccurrences } from '../lib/recur.js'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -11,7 +12,7 @@ const emit = defineEmits(['toggle'])
|
||||
const occurrences = computed(() => expandOccurrences(props.event))
|
||||
|
||||
function dowFor(dateStr) {
|
||||
return DOW[new Date(dateStr + 'T00:00:00').getDay()]
|
||||
return DOW[toDate(dateStr).getDay()]
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user