This commit is contained in:
@@ -170,7 +170,7 @@
|
||||
|
||||
<!-- Error Snackbar -->
|
||||
<v-snackbar
|
||||
v-model="showError"
|
||||
v-model="showErrorSnackbar"
|
||||
color="error"
|
||||
:timeout="5000"
|
||||
>
|
||||
@@ -178,7 +178,7 @@
|
||||
<template #actions>
|
||||
<v-btn
|
||||
variant="text"
|
||||
@click="showError = false"
|
||||
@click="showErrorSnackbar = false"
|
||||
>
|
||||
Close
|
||||
</v-btn>
|
||||
@@ -187,7 +187,7 @@
|
||||
|
||||
<!-- Success Snackbar -->
|
||||
<v-snackbar
|
||||
v-model="showSuccess"
|
||||
v-model="showSuccessSnackbar"
|
||||
color="success"
|
||||
:timeout="3000"
|
||||
>
|
||||
@@ -195,7 +195,7 @@
|
||||
<template #actions>
|
||||
<v-btn
|
||||
variant="text"
|
||||
@click="showSuccess = false"
|
||||
@click="showSuccessSnackbar = false"
|
||||
>
|
||||
Close
|
||||
</v-btn>
|
||||
@@ -244,8 +244,8 @@ const filters = reactive<EventFilters>({
|
||||
});
|
||||
|
||||
// Notification state
|
||||
const showError = ref(false);
|
||||
const showSuccess = ref(false);
|
||||
const showErrorSnackbar = ref(false);
|
||||
const showSuccessSnackbar = ref(false);
|
||||
const errorMessage = ref('');
|
||||
const successMessage = ref('');
|
||||
|
||||
@@ -378,35 +378,46 @@ const handleDateClick = (dateInfo: any) => {
|
||||
// Debug: Log the date format being passed
|
||||
console.log('[Events] Date clicked:', dateInfo);
|
||||
|
||||
// Ensure proper ISO format for datetime-local inputs
|
||||
// Create proper ISO datetime strings (full format)
|
||||
let formattedDate = '';
|
||||
let formattedEndDate = '';
|
||||
|
||||
if (dateInfo.date) {
|
||||
// Convert to local datetime-local format: YYYY-MM-DDTHH:mm
|
||||
// Convert to proper Date object and set default time
|
||||
const clickedDate = new Date(dateInfo.date);
|
||||
|
||||
// Set default time to 6 PM in the user's local timezone
|
||||
clickedDate.setHours(18, 0, 0, 0); // Default to 6 PM
|
||||
formattedDate = clickedDate.toISOString().slice(0, 16);
|
||||
formattedDate = clickedDate.toISOString(); // Full ISO string
|
||||
|
||||
// Set end date 2 hours later if not provided
|
||||
if (dateInfo.endDate) {
|
||||
formattedEndDate = new Date(dateInfo.endDate).toISOString().slice(0, 16);
|
||||
const endDate = new Date(dateInfo.endDate);
|
||||
endDate.setHours(20, 0, 0, 0); // Default to 8 PM for end date
|
||||
formattedEndDate = endDate.toISOString();
|
||||
} else {
|
||||
const endDate = new Date(clickedDate);
|
||||
endDate.setHours(20, 0, 0, 0); // Default to 8 PM
|
||||
formattedEndDate = endDate.toISOString().slice(0, 16);
|
||||
endDate.setHours(20, 0, 0, 0); // Default to 8 PM (2 hours later)
|
||||
formattedEndDate = endDate.toISOString();
|
||||
}
|
||||
}
|
||||
|
||||
prefilledDate.value = formattedDate;
|
||||
prefilledEndDate.value = formattedEndDate;
|
||||
// Clear previous values first to trigger watchers properly
|
||||
prefilledDate.value = '';
|
||||
prefilledEndDate.value = '';
|
||||
|
||||
console.log('[Events] Prefilled dates:', {
|
||||
date: formattedDate,
|
||||
endDate: formattedEndDate
|
||||
// Set new values
|
||||
nextTick(() => {
|
||||
prefilledDate.value = formattedDate;
|
||||
prefilledEndDate.value = formattedEndDate;
|
||||
|
||||
console.log('[Events] Prefilled dates set:', {
|
||||
date: formattedDate,
|
||||
endDate: formattedEndDate
|
||||
});
|
||||
|
||||
showCreateDialog.value = true;
|
||||
});
|
||||
|
||||
showCreateDialog.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -482,12 +493,12 @@ const subscribeCalendar = async () => {
|
||||
|
||||
const showErrorMessage = (message: string) => {
|
||||
errorMessage.value = message;
|
||||
showError.value = true;
|
||||
showErrorSnackbar.value = true;
|
||||
};
|
||||
|
||||
const showSuccessMessage = (message: string) => {
|
||||
successMessage.value = message;
|
||||
showSuccess.value = true;
|
||||
showSuccessSnackbar.value = true;
|
||||
};
|
||||
|
||||
// Lifecycle
|
||||
|
||||
Reference in New Issue
Block a user