fix blocked/occupied slot detection always returning false

Service.fromJson stored day as the raw Prisma JSON string
"2024-01-15T00:00:00.000Z", but _isSelfBooked/_isOccupied/_isBlocked
compared it against "2024-01-15" (toIso8601String().split('T').first),
so the match always failed and every slot appeared as Disponible.

Normalize day to the date-only portion in fromJson so all comparisons
work correctly across ProfessionalCalendarView and CalendarView.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-12 19:14:42 -05:00
co-authored by Claude Sonnet 4.6
parent 577c4737ae
commit 46acad0b55
+1 -1
View File
@@ -67,7 +67,7 @@ class Service {
aditionalAddress: (doc['additional_address'] ?? doc['aditional_address']) as String? ?? '',
latitude: (doc['latitude'] as num?)?.toDouble() ?? 0.0,
longitude: (doc['longitude'] as num?)?.toDouble() ?? 0.0,
day: doc['day']?.toString() ?? '',
day: (doc['day']?.toString() ?? '').split('T').first,
createdAt: doc['created_at']?.toString() ?? '',
description: doc['description'] as String? ?? '',
range1Hour1: _parseTime(doc['range1_hour1']?.toString() ?? '0:0'),