This commit is contained in:
Timothy Jaeryang Baek 2026-10-08 23:33:37 +04:00
parent 81b5346c26
commit 34abd6e121
2 changed files with 4 additions and 4 deletions

View file

@ -11,6 +11,7 @@
export let visibleCalendarIds: Set<string> = new Set();
export let view: 'month' | 'week' | 'day' = 'month';
export let currentDate: Date = new Date();
export let onNavigate: () => void = () => {};
const NS = 1_000_000;
const DAY_NAMES = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
@ -120,6 +121,7 @@
function handleDayClick(day: Date) {
currentDate = day;
onNavigate();
const ms = new Date(day.getFullYear(), day.getMonth(), day.getDate(), 9).getTime();
dispatch('createEvent', { start_at: ms * NS });
}
@ -127,8 +129,7 @@
function goToDayView(day: Date) {
currentDate = day;
view = 'day';
dispatch('viewChange', view);
dispatch('navigate', { date: currentDate });
onNavigate();
}
function handleHourClick(day: Date, hour: number) {

View file

@ -370,8 +370,7 @@
bind:currentDate
on:createEvent={handleCreateEvent}
on:eventClick={handleEventClick}
on:navigate={handleNavigate}
on:viewChange={handleNavigate}
onNavigate={handleNavigate}
/>
</div>
</div>