fix: compare service days as dates, not raw strings
DateTime.toString() renders "2026-07-13 00:00:00.000Z" while the backend sends "2026-07-13T00:00:00.000Z", so every day comparison was false and no booked slot was ever detected. Both calendars showed fully free days. The client calendar now also treats an unloaded agenda as busy instead of free: rendering a taken slot as available leads straight to a double booking. Note: the client still reads /services/professional/calendar, which returns the *caller's* calendar. There is no endpoint for another professional's agenda, so a client cannot yet see which of that professional's slots are taken. That needs a backend endpoint. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
2c1ba7f6d5
commit
8c6e2ae024
@@ -6,6 +6,7 @@ import 'package:intl/intl.dart';
|
||||
import 'package:professional_repository/professional_repository.dart';
|
||||
import 'package:prosappco/blocs/service_bloc/service_bloc.dart';
|
||||
import 'package:prosappco/screens/service/professional_service_screen.dart';
|
||||
import 'package:prosappco/utils/service_day.dart';
|
||||
import 'package:prosappco/utils/time_of_day_extension.dart';
|
||||
import 'package:prosappco/utils/time_of_day_utils.dart';
|
||||
import 'package:service_repository/service_repository.dart';
|
||||
@@ -596,7 +597,7 @@ class _ProfessionalCalendarScreenState
|
||||
TimeOfDay time, List<ServiceEntity>? services, DateTime day) {
|
||||
if (services == null) return null;
|
||||
for (final s in services) {
|
||||
if (day.toString() != s.day || s.range1Hour1 != time) continue;
|
||||
if (!isSameServiceDay(day, s.day) || s.range1Hour1 != time) continue;
|
||||
if (s.status == ServiceStatus.cancelled ||
|
||||
s.status == ServiceStatus.denied) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user