fixes
Build And Push Image / docker (push) Successful in 1m25s Details

This commit is contained in:
Matt 2025-08-13 23:15:29 +02:00
parent 198fbf3187
commit 1ab45cf503
1 changed files with 80 additions and 5 deletions

View File

@ -492,7 +492,19 @@ watch(startDate, (newStartDate) => {
// Watch for separate date and time changes to combine them
watch([startDate, startTime], ([newDate, newTime]) => {
if (newDate && newTime) {
const combinedDateTime = new Date(`${newDate}T${newTime}`);
console.log('[CreateEventDialog] Combining start date/time:', { date: newDate, time: newTime });
// Ensure time is in 24-hour format (HH:MM)
const normalizedTime = normalizeTimeFormat(newTime);
console.log('[CreateEventDialog] Normalized start time:', normalizedTime);
const combinedDateTime = new Date(`${newDate}T${normalizedTime}`);
if (isNaN(combinedDateTime.getTime())) {
console.error('[CreateEventDialog] Invalid start datetime created:', { date: newDate, time: newTime, normalized: normalizedTime });
return;
}
eventData.start_datetime = combinedDateTime.toISOString();
console.log('[CreateEventDialog] Combined start datetime:', eventData.start_datetime);
}
@ -500,7 +512,19 @@ watch([startDate, startTime], ([newDate, newTime]) => {
watch([endDate, endTime], ([newDate, newTime]) => {
if (newDate && newTime) {
const combinedDateTime = new Date(`${newDate}T${newTime}`);
console.log('[CreateEventDialog] Combining end date/time:', { date: newDate, time: newTime });
// Ensure time is in 24-hour format (HH:MM)
const normalizedTime = normalizeTimeFormat(newTime);
console.log('[CreateEventDialog] Normalized end time:', normalizedTime);
const combinedDateTime = new Date(`${newDate}T${normalizedTime}`);
if (isNaN(combinedDateTime.getTime())) {
console.error('[CreateEventDialog] Invalid end datetime created:', { date: newDate, time: newTime, normalized: normalizedTime });
return;
}
eventData.end_datetime = combinedDateTime.toISOString();
console.log('[CreateEventDialog] Combined end datetime:', eventData.end_datetime);
}
@ -549,17 +573,68 @@ const onDatePickerClosed = () => {
// This handler ensures the date picker behaves correctly on mobile and desktop
};
// Helper functions
const normalizeTimeFormat = (timeString: string): string => {
// Ensure time is in HH:MM 24-hour format
if (!timeString) return '';
// If already in HH:MM format, return as is
if (/^\d{2}:\d{2}$/.test(timeString)) {
return timeString;
}
// Handle other potential formats (this is basic, can be expanded)
// For now, assume HTML time input gives us the correct format
return timeString;
};
// Validation functions
const validateEndTime = () => {
if (!startDate.value || !endDate.value || !startTime.value || !endTime.value) {
return false; // Return false (no error) if not all fields are filled
}
console.log('[CreateEventDialog] validateEndTime called with:', {
startDate: startDate.value,
endDate: endDate.value,
startTime: startTime.value,
endTime: endTime.value
});
// Only validate if start and end are on the same date
if (startDate.value === endDate.value) {
const start = startTime.value;
const end = endTime.value;
return start >= end; // Return true if there's an error (start >= end)
// Normalize time formats before creating Date objects
const normalizedStartTime = normalizeTimeFormat(startTime.value);
const normalizedEndTime = normalizeTimeFormat(endTime.value);
// Convert times to comparable format by creating full datetime objects
const startDateTime = new Date(`${startDate.value}T${normalizedStartTime}`);
const endDateTime = new Date(`${endDate.value}T${normalizedEndTime}`);
// Check if dates are valid
if (isNaN(startDateTime.getTime()) || isNaN(endDateTime.getTime())) {
console.error('[CreateEventDialog] Invalid datetime created in validation:', {
startDateTime: startDateTime.toString(),
endDateTime: endDateTime.toString(),
normalizedStartTime,
normalizedEndTime
});
return true; // Return error if dates are invalid
}
console.log('[CreateEventDialog] Time comparison:', {
startDateTime: startDateTime.toISOString(),
endDateTime: endDateTime.toISOString(),
startTimestamp: startDateTime.getTime(),
endTimestamp: endDateTime.getTime(),
endIsAfterStart: endDateTime.getTime() > startDateTime.getTime()
});
// Return true if there's an error (end is NOT after start)
const hasError = endDateTime.getTime() <= startDateTime.getTime();
console.log('[CreateEventDialog] Validation result - hasError:', hasError);
return hasError;
}
return false; // No error if different dates