fixes
Build And Push Image / docker (push) Successful in 1m25s
Details
Build And Push Image / docker (push) Successful in 1m25s
Details
This commit is contained in:
parent
198fbf3187
commit
1ab45cf503
|
|
@ -492,7 +492,19 @@ watch(startDate, (newStartDate) => {
|
||||||
// Watch for separate date and time changes to combine them
|
// Watch for separate date and time changes to combine them
|
||||||
watch([startDate, startTime], ([newDate, newTime]) => {
|
watch([startDate, startTime], ([newDate, newTime]) => {
|
||||||
if (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();
|
eventData.start_datetime = combinedDateTime.toISOString();
|
||||||
console.log('[CreateEventDialog] Combined start datetime:', eventData.start_datetime);
|
console.log('[CreateEventDialog] Combined start datetime:', eventData.start_datetime);
|
||||||
}
|
}
|
||||||
|
|
@ -500,7 +512,19 @@ watch([startDate, startTime], ([newDate, newTime]) => {
|
||||||
|
|
||||||
watch([endDate, endTime], ([newDate, newTime]) => {
|
watch([endDate, endTime], ([newDate, newTime]) => {
|
||||||
if (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();
|
eventData.end_datetime = combinedDateTime.toISOString();
|
||||||
console.log('[CreateEventDialog] Combined end datetime:', eventData.end_datetime);
|
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
|
// 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
|
// Validation functions
|
||||||
const validateEndTime = () => {
|
const validateEndTime = () => {
|
||||||
if (!startDate.value || !endDate.value || !startTime.value || !endTime.value) {
|
if (!startDate.value || !endDate.value || !startTime.value || !endTime.value) {
|
||||||
return false; // Return false (no error) if not all fields are filled
|
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
|
// Only validate if start and end are on the same date
|
||||||
if (startDate.value === endDate.value) {
|
if (startDate.value === endDate.value) {
|
||||||
const start = startTime.value;
|
// Normalize time formats before creating Date objects
|
||||||
const end = endTime.value;
|
const normalizedStartTime = normalizeTimeFormat(startTime.value);
|
||||||
return start >= end; // Return true if there's an error (start >= end)
|
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
|
return false; // No error if different dates
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue