From c4cf67119c9b020881b8bd149ae68d524f3b78f0 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 13 Sep 2026 16:56:59 +0300 Subject: [PATCH] Dubai timezone handled --- lib/core/utils/date_util.dart | 20 +++++++++---------- .../widgets/appointment_card.dart | 2 +- .../widgets/appointment_doctor_card.dart | 5 +---- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/lib/core/utils/date_util.dart b/lib/core/utils/date_util.dart index 97c8dad0..7510786d 100644 --- a/lib/core/utils/date_util.dart +++ b/lib/core/utils/date_util.dart @@ -28,21 +28,21 @@ class DateUtil { const end = "+0300)"; final startIndex = date.indexOf(start); final endIndex = date.indexOf(end, startIndex + start.length); - // if (projectId == 2 || projectId == 3) { - // return DateTime.fromMillisecondsSinceEpoch( - // int.parse( - // date.substring(startIndex + start.length, endIndex), - // ), - // isUtc: true) - // .add(Duration(hours: 4)); - // } else { - return DateTime.fromMillisecondsSinceEpoch( + if (projectId == 2 || projectId == 3) { + return DateTime.fromMillisecondsSinceEpoch( + int.parse( + date.substring(startIndex + start.length, endIndex), + ), + isUtc: true) + .add(Duration(hours: 4)); + } else { + return DateTime.fromMillisecondsSinceEpoch( int.parse( date.substring(startIndex + start.length, endIndex), ), isUtc: true) .add(Duration(hours: 3)); - // } + } } else { return DateTime.now(); } diff --git a/lib/presentation/appointments/widgets/appointment_card.dart b/lib/presentation/appointments/widgets/appointment_card.dart index 38c6c7d3..1eeb842c 100644 --- a/lib/presentation/appointments/widgets/appointment_card.dart +++ b/lib/presentation/appointments/widgets/appointment_card.dart @@ -321,7 +321,7 @@ class _AppointmentCardState extends State { icon: AppAssets.appointment_calendar_icon, richText: widget.isLoading ? 'Cardiology'.toText10().toShimmer2(isShow: widget.isLoading) - : "${DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.patientAppointmentHistoryResponseModel.appointmentDate), false)} ${DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(widget.patientAppointmentHistoryResponseModel.appointmentDate), false)}" + : "${DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.patientAppointmentHistoryResponseModel.appointmentDate), false)} ${(widget.patientAppointmentHistoryResponseModel.startTime != null && widget.patientAppointmentHistoryResponseModel.startTime!.isNotEmpty) ? widget.patientAppointmentHistoryResponseModel.startTime!.substring(0, 5) : DateUtil.formatDateToTimeLang(DateUtil.convertStringToDateSaudiTimezone(widget.patientAppointmentHistoryResponseModel.appointmentDate!, widget.patientAppointmentHistoryResponseModel.projectID), false)}" .toText10(isEnglishOnly: true, isBold: true), ).toShimmer2(isShow: widget.isLoading), ), diff --git a/lib/presentation/appointments/widgets/appointment_doctor_card.dart b/lib/presentation/appointments/widgets/appointment_doctor_card.dart index dc7bb0af..4dd838ea 100644 --- a/lib/presentation/appointments/widgets/appointment_doctor_card.dart +++ b/lib/presentation/appointments/widgets/appointment_doctor_card.dart @@ -142,10 +142,7 @@ class AppointmentDoctorCard extends StatelessWidget { child: AppCustomChipWidget( labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 6.w), icon: AppAssets.doctor_calendar_icon, - richText: "${DateUtil.formatDateToDate(DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false)} ${DateUtil.formatDateToTimeLang( - DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), - false, - )}" + richText: "${DateUtil.formatDateToDate(DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false)} ${(patientAppointmentHistoryResponseModel.startTime != null && patientAppointmentHistoryResponseModel.startTime!.isNotEmpty) ? patientAppointmentHistoryResponseModel.startTime!.substring(0, 5) : DateUtil.formatDateToTimeLang(DateUtil.convertStringToDateSaudiTimezone(patientAppointmentHistoryResponseModel.appointmentDate!, patientAppointmentHistoryResponseModel.projectID), false)}" .toText10(isBold: true), ), ),