mirror of
https://github.com/marcogll/AnchorOS.git
synced 2026-03-15 14:24:27 +00:00
fix: Correct calendar offset and fix business hours showing only 22:00-23:00
FIX 1 - Calendar Day Offset (already fixed in previous commit): - Corrected DatePicker component to calculate proper day offset - Added padding cells for correct weekday alignment - January 1, 2026 now correctly shows as Thursday instead of Monday FIX 2 - Business Hours Only Showing 22:00-23:00: PROBLEM: - Time slots API only returned 22:00 and 23:00 as available hours - Incorrect business hours in database (likely 22:00-23:00 instead of 10:00-19:00) - Poor timezone conversion in get_detailed_availability function ROOT CAUSES: 1. Location business_hours stored incorrect hours (22:00-23:00) 2. get_detailed_availability had timezone concatenation issues - Used string concatenation for timestamp construction - Didn't properly handle timezone conversion 3. Fallback to defaults was using wrong values SOLUTIONS: 1. Migration 20260118080000_fix_business_hours_default.sql: - Update default business hours to normal salon hours - Mon-Fri: 10:00-19:00 - Saturday: 10:00-18:00 - Sunday: Closed 2. Migration 20260118090000_fix_get_detailed_availability_timezone.sql: - Rewrite get_detailed_availability function - Use make_timestamp() instead of string concatenation - Proper timezone handling with AT TIME ZONE - Better NULL handling for business_hours - Fix is_available_for_booking COALESCE to default true CHANGES: - components/booking/date-picker.tsx: Added day offset calculation - supabase/migrations/20260118080000.sql: Fix default business hours - supabase/migrations/20260118090000.sql: Fix timezone in availability function
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
-- ============================================
|
||||
-- FIX: Corregir horarios de negocio por defecto
|
||||
-- Date: 20260118
|
||||
-- Description: Fix business hours that only show 22:00-23:00
|
||||
-- ============================================
|
||||
|
||||
-- Verificar horarios actuales
|
||||
SELECT id, name, timezone, business_hours FROM locations;
|
||||
|
||||
-- Actualizar horarios de negocio a horarios normales
|
||||
UPDATE locations
|
||||
SET business_hours = '{
|
||||
"monday": {"open": "10:00", "close": "19:00", "is_closed": false},
|
||||
"tuesday": {"open": "10:00", "close": "19:00", "is_closed": false},
|
||||
"wednesday": {"open": "10:00", "close": "19:00", "is_closed": false},
|
||||
"thursday": {"open": "10:00", "close": "19:00", "is_closed": false},
|
||||
"friday": {"open": "10:00", "close": "19:00", "is_closed": false},
|
||||
"saturday": {"open": "10:00", "close": "18:00", "is_closed": false},
|
||||
"sunday": {"is_closed": true}
|
||||
}'::jsonb
|
||||
WHERE business_hours IS NULL
|
||||
OR business_hours = '{}'::jsonb;
|
||||
|
||||
-- Verificar que los horarios se actualizaron correctamente
|
||||
SELECT id, name, timezone, business_hours FROM locations;
|
||||
Reference in New Issue
Block a user